English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
border-top-The width CSS attribute is used to set the width of the top border of the element. However, in many cases, like border-widthorborder-topSuch a shorthand CSS attribute is more convenient and preferable to use.
The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.
Default value: | medium |
---|---|
Applicable to: | All elements |
Inheritance: | No |
Animatable: | Yes.Please refer to Animation properties. |
Version: | CSS 1,2,3 |
JavaScript syntax: | object object.style.borderTopWidth="thick" |
The syntax of this attribute is as follows:
border-top-width: thin | medium | thick | length | inherit
The following examples demonstrate how to use the border-top-width attribute.
p { border-style: solid; border-top-width: 15px; }Test and see‹/›
Note:You must specify in the border-bottom-width attribute is declared beforeborder-styleAttribute. The element must have a border before the border width 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 | Thin border. |
medium | Medium border. |
thick | Thick border. |
Length | Length values in units such as px, pt, cm, em, etc. Negative values are not allowed. |
initial | Set this property to its default value. |
inherit | If specified, the associated element adopts its parent element's border-top-The value of the width attribute. |
border-top-Browser compatibility of the width attribute, the numbers in the table below represent the minimum version number of the browser that supports this attribute; all mainstream browsers support this attribute.
|
See tutorial:CSS Border,CSS3 Border.
Related properties:border,border-width,border-top,border-top-color,
border-top-style.