Set the border-spacing for a table:
#table1 {
border-collapse: separate;
border-spacing: 15px;
}
#table2 {
border-collapse: separate;
border-spacing: 15px 50px;
}
Try it Yourself »
The border-spacing
property sets the distance between the borders of adjacent cells.
Note: This property works only when border-collapse is separate.
Default value: | 2px |
---|---|
Inherited: | yes |
Animatable: | yes. Read about animatable Try it |
Version: | CSS2 |
JavaScript syntax: | object.style.borderSpacing="15px" Try it |
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
border-spacing | 1.0 | 8.0 | 1.0 | 1.0 | 4.0 |
border-spacing:
length|initial|inherit;
Value | Description | Demo |
---|---|---|
length length | Specifies the distance between the borders of adjacent cells in px, cm, etc. Negative values are not allowed.
|
Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
CSS tutorial: CSS Table
HTML DOM reference: borderSpacing property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!