html border-spacing
时间: 2023-09-02 14:15:43 浏览: 94
一个属性border-collapse解决Table的边框问题
5星 · 资源好评率100%
The CSS property `border-spacing` is used to specify the space between cells in a table. It sets the distance between the borders of adjacent cells.
The `border-spacing` property is supported in all major web browsers, including Chrome, Firefox, Safari, and Microsoft Edge.
The syntax for the `border-spacing` property is:
```css
table {
border-spacing: value;
}
```
The value can be specified as a single value or two values separated by a space. If a single value is specified, it is used for both the horizontal and vertical spacing. If two values are specified, the first value is used for the horizontal spacing and the second value is used for the vertical spacing.
The value can be a length, a percentage, or the keywords `inherit` or `initial`. The length or percentage value specifies the distance between the borders of adjacent cells. The `inherit` value specifies that the property should be inherited from the parent element, and the `initial` value specifies the default value for the property.
For example, to set the border-spacing of a table to 10 pixels, you would use the following CSS:
```css
table {
border-spacing: 10px;
}
```
To set the horizontal spacing to 10 pixels and the vertical spacing to 5 pixels, you would use the following CSS:
```css
table {
border-spacing: 10px 5px;
}
```
阅读全文