Set the space between cells in a table:
document.getElementById("myTable").style.borderSpacing = "20px";
Try it Yourself »
The borderSpacing property sets or returns the space between cells in a table.
Note: This property has no effect if borderCollapse is set to collapse.
Property | |||||
---|---|---|---|---|---|
borderSpacing | Yes | 9.0 | Yes | Yes | Yes |
Return the borderSpacing property:
object.style.borderSpacing
Set the borderSpacing property:
object.style.borderSpacing
= "length length|initial|inherit"
Value | Description |
---|---|
length length | Specifies the space between cells in length units. Negative values are not allowed. Default value is 0.
|
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | 0 |
---|---|
Return Value: | A String, representing the space between cells in a table |
CSS Version | CSS2 |
Return the space between cells in a table:
alert(document.getElementById("myTable").style.borderSpacing);
Try it Yourself »
CSS tutorial: CSS Table
CSS reference: border-spacing property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!