Latest web development tutorials

HTML DOM Style borderCollapse property

Style Object Reference Style Objects

Examples

Folding table borders:

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

try it"

Definition and Usage

BorderCollapse property sets or returns whether the table borders are collapsed into a single border.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support borderCollapse property.


grammar

Back borderCollapse properties:

object .style.borderCollapse

Setting borderCollapse properties:

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

Property Value

描述
separate 为所有的表格单元格元素绘制单独的边框,边框不会被合并为一个单一的边框。这是默认的。
collapse 表格单元格元素之间不会绘制边框,边框会被合并为一个单一的边框。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: separate
return value: String that represents the border of the table.
CSS version CSS2


More examples

Examples

Back borderCollapse properties:

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

try it"


related articles

CSS tutorial: CSS the Table (table)

CSS Reference: border-attribute Collapse


Style Object Reference Style Objects