Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style borderCollapse property

Style borderCollapse property

Style Object Reference The Style object

Example

Collapse the borders of a table:

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

Try it »


Definition and Usage

The borderCollapse property sets or returns whether the borders of a table are collapsed into a single border.


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the borderCollapse property.


Syntax

Return the borderCollapse property:

object

.style.borderCollapse

Set the borderCollapse property:

object

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

Attribute values

Value Description
separate Separate borders are drawn for all table cell elements; the borders are not merged into a single border. This is the default.
collapse No borders are drawn between table cell elements; the borders are merged into a single border.
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 borders of the table.
CSS version CSS2

More examples

Example

Return the borderCollapse property:

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

Try it »


Related Articles

CSS tutorial:CSS Table

CSS Reference Manual:The border-collapse property


Style Object Reference The Style object