CSS 属性:border-width
一个框的边框的宽度,位于内容和内边距区域周围,边距区域之前。
使用一个值,border-width属性可以用来为框指定一个统一的边框。使用两个、三个或四个值,可以独立指定各边。
可能的值
| 值 | 注意 | 示例 |
|---|---|---|
| [length] | 不应为负值。 | 10px |
thin (细) | ||
medium | ||
thick (粗) | ||
inherit | ||
initial | ||
unset | ||
多个值
一个、两个、三个或四个用空格分隔的值
| 值 | 注意 | 示例 |
|---|---|---|
| [值] | [上,右,下,左] | 10px |
| [值] [值] | [上和下] [左和右] | 10px 20px |
| [值] [值] [值] | [上] [右和左] [下] | 10px 20px 30px |
| [值] [值] [值] [值] | [上] [右] [下] [左] | 10px 20px 30px 40px |
示例
aside { border-style: solid; }
/* Establishes a border style for border widths to apply (assuming the following are aside elements). */
#natterjack { border-width: 1px; }
/* Uniform border width of 12px on all four sides. */
#crestednewt { border-width: 2px 5px; }
/* Top and bottom border width are each 2px. Left and right border width are each 5px. */
#poolfrog { border-width: 0.5em 1px 3em; }
/* Top border width is 0.5em. Left and right border width are each 1px. Bottom border width is 3em. */
#smoothnewt { border-width: 10px 20px 30px 40px; }
/* Top border width is 10px. Right border width is 20px. Bottom border width is 30px. Left border width is 40px. */
