CSS PROPERTIES
Expand All|Collapse All
CSS AT-RULES
SPONSORED LINKS

CSS border-spacing Property

Topic: CSS3 Properties Reference« Prev|Next »

Description

The border-spacing CSS property sets the spacing between the borders of adjacent table cells using the separated border model. If the collapsing border model is used, this property is ignored. See the border-collapse property.

The following table summarizes the usages context and the version history of this property.

Default value: 0
Applies to: The table and inline-table elements
Inherited: Yes
Animatable: Yes. See animatable properties.
Version: CSS 2, 3

Syntax

The syntax of the property is given with:

border-spacing [ length ] 1 or 2 values | initial | inherit

The border-spacing property can take one, or two whitespace separated length values.

  • If one value is specified, it applies to both the horizontal and vertical border spacing.
  • If two values are specified, the first sets the horizontal border spacing, and the second sets the vertical border spacing.

The example below shows the border-spacing property in action.

  • table {
  •     border-collapse: separate;
  •     border-spacing: 10px 20px;
  • }

Property Values

The following table describes the values of this property.

Value Description
length A length value in px, pt, cm, em, etc. Negative values are not allowed.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element border-spacing property.

Browser Compatibility

The border-spacing property is supported in all major modern browsers.

Browsers Icon

Browser Support–

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 8+
  • Apple Safari 1+
  • Opera 4+
 

Warning:Internet Explorer 7 and earlier versions don't support the border-spacing property. IE8 supports this property only if a <!DOCTYPE> is specified.


Further Reading

See tutorial on: CSS Tables, CSS Border, CSS3 Border.

Table-related properties: border-collapse, empty-cells, table-layout.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.