Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

There were scripting errors on this page. While those are being addressed by site editors, you can view partial content below.

{{ CSSRef }}

Summary

The border-spacing CSS property specifies the distance between the borders of adjacent table cells (only for the separated borders model). This is equivalent to the cellspacing attribute in presentational HTML, but an optional second value can be used to set different horizontal and vertical spacing.

The border-spacing value is also used along the outside edge of the table, where the distance between the table's border and the cells in the first/last column or row is the sum of the relevant (horizontal or vertical) border-spacing and the relevant (top, right, bottom, or left) padding on the table.

This property applies only when border-collapse is separate.

{{ cssinfo }}

Syntax

/* border-spacing: length */
border-spacing: 2px;

/* border-spacing: horizontal vertical */
border-spacing: 1% 2em;

border-spacing: inherit;

Values

length
Is a <length> value that describes both the horizontal and vertical spacings between cells. It is used only in the one-value syntax.
horizontal
Is a <length> value that describes the horizontal spacing between cells, that is the space between cells in adjacent columns. It is used only in the two-value syntax.
vertical
Is a <length> value that describes the vertical spacing between cells, that is the space between cells in adjacent rows. It is used only in the two-value syntax.
inherit
Is a keyword indicating that the calculated value of border-spacing of the parent's element must be used.

Formal syntax

{{ csssyntax }}

Examples

View Live Examples

table { border-spacing: 10px 5px; }

Specifications

Specification Status Comment
CSS Level 2 (Revision 1)
The definition of 'border-spacing' in that specification.
Recommendation Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 1.0 (1.7 or earlier) 8.0 4.0 1.0 (85)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? 1.0 (1.9.2) ? ? ?

Document Tags and Contributors

 Last updated by: Sebastianz,