CSS property: border-spacing

Description

The distance that separates adjoining cell borders.

The lengths specify 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.

The distance between the table border and the borders of the cells on the edge of the table is the table's padding for that side, plus the relevant border spacing distance. For example, on the right hand side, the distance is padding-right + horizontal border-spacing.

The width of the table is the distance from the left inner padding edge to the right inner padding edge (including the border spacing but excluding padding and border).

However, in HTML and XHTML1, the width of the <table> element is the distance from the left border edge to the right border edge.

Syntax

border-spacing: <length>;

Values

<length>

The distance that separates adjoining cell borders.

Versions

Examples

table {
    border-width: 1px;
    border-style: solid;
    border-color: #000;
    border-collapse: separate;
    border-spacing: 10px;
}