Style borderCollapseProperty

Style 对象参考手册Style Object

Example

Collapse table borders:

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

Try it yourself »

Definition and Usage

The borderCollapse property sets or returns whether the table border is 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"

Property Values

Value Description
separate Draws separate borders for all table cell elements. Borders are not merged into a single border. This is default.
collapse No borders are drawn between table cell elements. Borders are merged into a single border.
initial Sets this property to its default value. Seeinitial。
inherit Inherits this property from its parent element. Seeinherit。

Technical Details

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


More Examples

Example

Return the borderCollapse property:

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

Try it yourself »


Related Articles

CSS Tutorial:CSS Table

CSS Reference:border-collapse property


Style 对象参考手册Style Object

Other Extensions