CSS border-spacing Property
Description
The border-spacing property controls the amount of space between adjacent cells in a table when the table uses the separated borders model. It creates a visible gap between the outer edges of neighboring cell borders so that the table's background (or whatever sits behind the cells) is exposed in that gap rather than the cell backgrounds being contiguous. This property only has an effect when the table is not using collapsed borders - see border-collapse for how the two border models differ.
At a conceptual level, border-spacing defines independent horizontal and vertical gaps between the boxes that represent table cells, allowing different spacing in each direction if desired. Those gaps are applied outside each cell’s own border, so they do not replace cell borders or internal padding; instead they add extra separation and therefore contribute to the table’s overall width and height. Because the gaps sit between cell borders, cell backgrounds do not fill the spacing - the table background (or underlying content) shows through.
In practice, designers use border-spacing to create breathing room between cells without increasing the internal padding of cells or adjusting individual cell margins. It’s a convenient way to control the visual rhythm of a table - for example to make grid data easier to scan - while keeping borders and cell contents unchanged. Keep in mind that using spacing influences layout calculations, so when precise alignment or fixed table sizing is required you may need to combine it thoughtfully with other layout choices or use alternative techniques.
Definition
- Initial value
- 0
- Applies to
- 'table' and 'inline-table' elements*
- Inherited
- Yes
- Computed value
- Two absolute lengths
- Animatable
- No
- JavaScript syntax
- object.style.borderSpacing
Interactive Demo
| Bananas | 5 Dollars |
| Bananas | 10 Dollars |
| Oranges | 2 Dollars |
| Grapes | 3 Dollars |
Syntax
border-spacing: <length> <length>? | inherit
Values
- <length>The distance that separates adjoining cell borders. If one length is specified, it gives both the horizontal and vertical spacing. If two are specified, the first gives the horizontal spacing and the second the vertical spacing. Lengths may not be negative.
Example
Browser Support
The following information will show you the current browser support for the CSS border-spacing property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
