1. Home
  2. Computing & Technology
  3. Web Design / HTML

border-spacing

By Jennifer Kyrnin, About.com

border-spacing Description:

The border-spacing property defines the distance that separates adjoining cell borders. It is used with the separated borders model (border-collapse: separate).

border-spacing in CSS Versions:

border-spacing Syntax:

border-spacing: <length> <length>? | inherit

In the case of two units, the first is the horizontal length and the second is the vertical length. The second length unit is optional, if left out, it is assumed to be the same as the first.

border-spacing Initial Value:

0

border-spacing Applies To:

Table and inline-table elements.

User-agents may apply this property to frameset elements, which are not defined in the CSS 2 specification.

border-spacing Inheritance:

This property is inherited.

border-spacing Browser Support:

border-spacing media type:

  • Visual

border-spacing Examples:

Standard border-spacing property

<table style="border-spacing : 5 3;">
<tr><td>The cells in this table will 5 pixel horizontal borders and 3 pixel vertical borders</td>
<td>This is the second column.</td></tr>
</table>

border-spacing Special Notes:

  • 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. Ie. padding-left + 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). But in HTML and XHTML 1, the width of the table element is the distance from left border edge to right border edge.

More border-spacing Information

Return to the Style Library

Explore Web Design / HTML

More from About.com

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. CSS
  5. Style Properties
  6. CSS Style Property: border-spacing

©2008 About.com, a part of The New York Times Company.

All rights reserved.