border-spacing

Property for controlling the spacing between the borders of table cells.

Time to read: less than 5 min

Briefly

The border-spacing property sets the spacing between the borders of table cells.

Example

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

        
        
          
        
      
Open demo in the new window

How to write

You can specify one or two non-negative values:

  1. border-spacing: 1px — the distance between cells is the same on all sides.
  2. border-spacing: 1px 2px — the first value sets the distance between cells horizontally, the second — vertically.

How to understand

The border-spacing property sets the distance between table cells. This property works only for tables with the border-collapse property set to separate.

Spacing will also appear around the table, so the distance between the table cells and its border will be the sum of the border-spacing values and the padding of the table.