CSS border-color property
Example
Set the colors of the four borders:
p
{
border-style:solid;
border-color:#ff0000 #0000ff;
}
Try it »
Property definition and usage
The border-color property sets the colors of all four borders of an element. This property can have one to four values.
Example:
border-color: red, green, blue, pink;
- The top border is red
- The right border is green
- The bottom border is blue
- The left border is pink
border-color: red, green, blue;
- The top border is red
- The left and right borders are green
- The bottom border is blue
border-color: red, green;
- The top and bottom borders are red
- The left and right borders are green
border-color: red;
- All four borders are red
**Note:** Always declare the border-style property before the border-color property. An element must have a border before you can change its color.
| Default value: | not specified |
|---|---|
| Inherited: | no |
| Version: | CSS1 |
| JavaScript syntax: | object object.style.borderColor="#FF0000 blue" |
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| border-color | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Attribute values
| Value | Description |
|---|---|
| color | Specifies the background color. SeeCSS color valuesFind the complete list of color values |
| transparent | Specifies that the border color should be transparent. This is the default |
| inherit | Specifies that the border color should be inherited from the parent element |
Related Articles
CSS Tutorial: CSS Border