Style borderCollapse Property
Example
Collapse the table border:
document.getElementById("myTable").style.borderCollapse = "collapse";Try it Yourself »
More "Try it Yourself" examples below.
Description
The borderCollapse property sets or returns whether the table border should be collapsed into a single border or not.
Syntax
Return the borderCollapse property:
object.style.borderCollapse
Set the borderCollapse property:
object.style.borderCollapse = "separate|collapse|initial|inherit"
Property Values
| Value | Description |
|---|---|
| separate | Separate borders are drawn for all table cell elements. This is default |
| collapse | Borders are not drawn between table cell elements |
| initial | Sets this property to its default value. Read about initial |
| inherit | Inherits this property from its parent element. Read about inherit |
Technical Details
| Default Value: | separate |
|---|---|
| Return Value: | A String, representing the borders of a table |
| CSS Version | CSS2 |
More Examples
Example
Return the borderCollapse property:
alert(document.getElementById("myTable").style.borderCollapse);
Try it Yourself »
Related Pages
CSS tutorial: CSS Table
CSS reference: border-collapse property
Browser Support
borderCollapse is a CSS2 (1998) feature.
It is fully supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera | IE |
| Yes | Yes | Yes | Yes | Yes | 9-11 |