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.
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
| Property | |||||
|---|---|---|---|---|---|
| borderCollapse | 1.0 | 5.0 | 1.0 | 1.2 | 4.0 | 
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
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.