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:Tabela CSS

CSS Reference Manual:border-collapse property

Instance

Example 1

Collapse table borders:

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

Try it yourself

Example 2

Return the borderCollapse property:

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

Try it yourself

Syntax

Return the borderCollapse property:

object.style.borderCollapse

Set the borderCollapse property:

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

Attribute value

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

If possible, the borders will merge 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 to fully support this attribute.

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