Style borderCollapse Property

Definition and Usage

borderCollapse Sets or returns whether the table borders should be collapsed into a single border.

See Also:

CSS Tutorial:CSS Table

CSS Reference Manual:border-collapse Property

Example

Example 1

Collapse Table Borders:

document.getElementById("myTable").style.borderCollapse = "collapse";

Try It Yourself

Example 2

Return borderCollapse Property:

alert(document.getElementById("myTable").style.borderCollapse);

Try It Yourself

Syntax

Return borderCollapse Property:

object.style.borderCollapse

Set borderCollapse Property:

object.style.borderCollapse = "separate|collapse|initial|inherit"

Property Value

Value Description
separate Draws separate borders for all table cell elements. Default.
collapse

If possible, the borders will be merged into a single border.

The border-spacing and empty-cells properties will be ignored.

initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical Details

Default Value: separate
Return Value: A string representing the table border.
CSS Version: CSS2

Browser Support

The numbers in the table indicate the first browser version that fully supports this property.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
1.0 5.0 1.0 1.2 4.0