English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
border-top-color CSS attribute is used to set the color of the upper border of the element separately. However, in many cases, like border-colororborder-topSuch shorthand CSS properties are more convenient and preferable to use.
The following table provides usage instructions and version history of this attribute, as well as its syntax in JavaScript scripts.
Default value: | colorAttribute value |
---|---|
Applies to: | All elements |
Inheritance: | No |
Animated: | Yes.Please refer to Animation properties. |
Version: | CSS 1,2,3 |
JavaScript syntax: | object.style.borderTopColor="red" |
The syntax of this attribute is as follows:
border-top-color: color | transparent | initial | inherit
The following examples demonstrate how to use border-top-color attribute.
p { border-style: solid; border-top-color: #ff0000; }Test and see‹/›
Note:You must specify in border-bottom-width attribute is declared beforeborder-styleAttribute. The element must have a border before it can set the border width, because theborder-styleThe default value of the attribute is none.
The following table describes the value of this attribute.
Value | Description |
---|---|
color | Specify the color of the top border. SeeCSS color valuesto get the list of possible color values. |
transparent | Allow the border to be transparent, although it may take upborder-widthThe space of the attribute setting. |
initial | Set this attribute to its default value. |
inherit | If specified, the associated element uses its parent element's border-top-The value of color attribute. |
border-top-The compatibility of color attribute across browsers; the numbers in the table below represent the minimum version number of browsers that support this attribute; all mainstream browsers support this attribute.
|
See tutorial:CSS Border,CSS3 Border.
Related properties:border,border-color,border-top,border-top-style,
border-top-width.