CSS border-color attribute
Examples
Set up four border color:
p
{
border-style:solid;
border-color:#ff0000 #0000ff;
}
{
border-style:solid;
border-color:#ff0000 #0000ff;
}
Attribute definitions and instructions
border-color attribute set four border color of an element. This property can have one to four values.
Example:
border-color: red, green, blue, pink;
- Red border
- Right border is green
- Bottom border is the blue
- Left border is pink
border-color: red, green, and blue;
- Red border
- Left and right border is green
- Bottom border is the 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 put before the border-color border-style attribute to the property declaration.Border element must be obtained before you change its color.
Defaults: | not specified |
---|---|
inherit: | no |
version: | CSS1 |
JavaScript syntax: | object object.style.borderColor = "# FF0000 blue" |
Browser Support
Figures in the table represent the first browser to support the version number of the property.
属性 | |||||
---|---|---|---|---|---|
border-color | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Property Value
value | Explanation |
---|---|
color | Specifies the background color. In the CSS color values to find a complete list of color values |
transparent | Specifies the color of the border should be transparent. This is the default |
inherit | Specifies the color of the border, should be inherited from the parent element |
related articles
CSS tutorial: CSS Border