CSS border-spacing Property

Set the CSS border-spacing Property for a table:

#table1 {
border-collapse: separate;
border-spacing: 15px;
}#table2 {
border-collapse: separate;
border-spacing: 15px 50px;

Try it Yourself »

Definition and Usage

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
CSS Syntax
border-spacing: length|initial|inherit;
Property Values
Value Description
length length Specifies the distance between the borders of adjacent cells in px, cm, etc. Negative values are not allowed.

  • If one value is specified, it defines both the horizontal and vertical spacing between cells
  • If two values are specified, the first sets the horizontal spacing and the second sets the vertical spacing
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit