THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Style borderCollapse Property

Style Object Reference Style Object

Example

Collapse the table border:

document.getElementById("myTable").style.borderCollapse = "collapse";
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

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


Style Object Reference Style Object