border-spacing

Summary

The border-spacing CSS property specifies the distance between the borders of adjacent 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.

  • Initial value 0
  • Applies to table and inline-table elements
  • Inherited yes
  • Media visual
  • Computed value two absolute lengths
  • Animatable no
  • Canonical order the unique non-ambiguous order defined by the formal grammar

Syntax

Formal syntax: <length> <length>?
border-spacing: length              /* one-value syntax */
border-spacing: horizontal vertical /* two-value syntax */

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.

Examples

View Live Examples

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

Specifications

Specification Status Comment
CSS Level 2 (Revision 1) Recommendation  

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) ? ? ?

See also

Document Tags and Contributors

Last updated by: kscarfone,
Hide Sidebar