CSS border-top-color property
Example
Set the top border color:
p
{
border-style:
solid
;
border-top-color:
#ff0000
}
Try it »
Property definition and usage
border-top-color sets the color of an element's top border.
**Note:** Always declare the border-style property before the border-top-color property. An element must have a border before you can change its color.
| Default value: | not specified |
|---|---|
| Inheritance: | no |
| Version: | CSS1 |
| JavaScript syntax: | object.style.borderTopColor="blue" |
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| border-top-color | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Attribute values
| Value | Description |
|---|---|
| color_name | Specifies a border color whose value is a color name (such as red). |
| hex_number | Specifies a border color whose value is a hexadecimal value (such as #ff0000). |
| rgb_number | Specifies a border color whose value is an rgb code (such as rgb(255,0,0)). |
| transparent | Default value. The border color is transparent. |
| inherit | Specifies that the border color should be inherited from the parent element. |
Related Articles
CSS Tutorial: CSS Border
CSS Reference Manual: border-top property