CSS border-spacing
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The border-spacing
CSS property sets the spacing between the borders of adjacent table cells using the separated border model. If the collapsing border model is used, this property is ignored. See the border-collapse
property.
The following table summarizes the usages context and the version history of this property.
Default value: | 0 |
---|---|
Applies to: | The table and inline-table elements |
Inherited: | Yes |
Animatable: | Yes. See animatable properties. |
Version: | CSS 2, 3 |
Syntax
The syntax of the property is given with:
The border-spacing
property can take one, or two whitespace separated length values.
- If one value is specified, it applies to both the horizontal and vertical border spacing.
- If two values are specified, the first sets the horizontal border spacing, and the second sets the vertical border spacing.
The example below shows the border-spacing
property in action.
Example
Try this code »table {
border-collapse: separate;
border-spacing: 10px 20px;
}
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
length | A length value in px , pt , cm , em , etc. Negative values are not allowed. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element border-spacing property. |
Browser Compatibility
The border-spacing
property is supported in all major modern browsers.
Browser Support–
|
Further Reading
See tutorial on: CSS Tables, CSS Border, CSS3 Border.
Table-related properties: border-collapse
, empty-cells
, table-layout
.