English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
border-The width CSS property is used to set the individual border width property, which is a shorthand property, and isborder-top-width,border-right-width,border-bottom-widthAndborder-left-widthAbbreviated property.
The following table provides usage instructions and version history for this property, as well as the syntax for using this property in JavaScript scripts.
Default value: | medium |
---|---|
Applicable to: | All elements |
The default value of the width attribute is none. | All elements |
Inheritance: | NoAnimatable: Yes.. |
Please refer to | CSS 1,2,3 |
Animation properties | Version:JavaScript syntax: |
.style.borderWidth="thin thick"
border-width usage syntax 1 The syntax of this attribute is as follows: 4 width: [ thin | medium | thick | length ]
to
values | inheritThis shorthand notation can take one, two, three, or four space-separated values.If specified
Three valuesOne valueIf specified, it will be applied to all borders.
Three valuesTwo valuesIf specified, the first value is used for the top and bottom borders, and the second value is used for the right and left borders.
Three valuesIf specified, the first value is used for the top border, the second value is used for the right and left borders, and the third value is used for the bottom border.Four values
If specified, each value will be applied to the border in the order of top, right, bottom, and left.-The following examples demonstrate how to use border
Example border-p { border-style: solid; 5width: px;}/Test and see‹
›border-styleNote:-bottom-The width attribute must be declared before the width of the border can be set, because theborder-styleThe default value of the attribute is none.
The following table describes the value of this attribute.
Value | Description |
---|---|
thin | Fine border. |
medium | Medium boundary. |
thick | Thick border. |
length | Length values in px, pt, cm, em, and other units are not allowed to be negative. |
inherit | If specified, the associated element adopts its parent element's border-The value of the width attribute. |
border-The compatibility of the width attribute of the browser, the numbers in the following table represent the minimum version number of the browser that supports this attribute; all mainstream browsers support this attribute.
Browser support–
|
See tutorial:CSS Border,CSS3 Border.
Related attributes:border,border-style,border-color,border-top-width,border-right-width,border-bottom-width,border-left-width.