English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
border-The 'spacing' CSS property uses the separated border model to set the spacing between adjacent table cell borders. If the collapsed border model is used, this property will be ignored. Please seeborder-collapseProperty.
The table below provides usage instructions and version history for this property, as well as the syntax for using this property in JavaScript scripts.
Default value: | 0 |
---|---|
Applies to: | tableand inline table (inline-table) element |
Inheritance: | Yes |
Can be animated: | Yes.Please refer to Animation properties. |
Version: | CSS 2,3 |
JavaScript syntax: | object object.style.borderSpacing="12px" |
The syntax of this attribute is as follows:
border-spacing: [ length ] 1 or 2 values | initial | inherit
this border-The spacing attribute can take one or two space-separated length values.
If specifiedone valuetheValueThe two values will be applied to both horizontal and vertical border spacing.
If specifiedtwo valuesIf specified, the first sets the horizontal border spacing, and the second sets the vertical border spacing.
The following example demonstrates how to use border-spacing attribute.
table { border-collapse: separate; border-spacing: 10px 20px; }Test to see‹/›
The following table describes the value of this attribute.
Value | Description |
---|---|
length | The length values such as px, pt, cm, em, etc., do not allow negative values. |
initial | Set this attribute to its default value. |
inherit | If specified, the associated element adopts the border of its parent element-The value of the spacing attribute. |
border-The compatibility of the spacing attribute of browsers, the numbers in the following table represent the minimum version number of the browser that supports this attribute; all mainstream browsers support this attribute.
|
Warning: Internet Explorer 7and earlier versions do not support this border-spacing attribute. IE8Only in<!DOCTYPE>This attribute is supported only when a is specified.
Please refer to the following tutorials:CSS table,CSS border,CSS3Border.
Table-related attributes:border-collapse,empty-cells,table-layout.