HTML CSS examples for CSS Property:border-color
The border-color CSS property is a shorthand property for setting the individual border color properties including:
The following table summarizes the border-color property.
Item | Value |
---|---|
Default value: | See individual properties |
Applies to: | All elements |
Inherited: | No |
Animatable: | Yes. |
The syntax of the property is as follows:
border-color: [ color | transparent ] 1 to 4 values | inherit
This shorthand notation can take one, two, three, or four whitespace separated values.
The following table describes the values of this property.
Value | Description |
---|---|
color | Set the border color. |
transparent | Allows the border to be transparent, it will occupy the space set by the border-width property. |
initial | Sets this property to its default value. |
inherit | takes the value of its parent element border-color property. |
The example below shows the border-color property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS border-color property</title> <style type="text/css"> p.one {<!--from www . jav a 2 s .c o m--> border-style: solid; border-color: #ff0000; } p.two { border-style: solid; border-color: #ff0000 #00ff00; } p.three { border-style: solid; border-color: #ff0000 #00ff00 #0000ff; } p.four { border-style: solid; border-color: #ff0000 #00ff00 #0000ff #ff00ff; } </style> </head> <body> <p class="one"><strong>one-value syntax:</strong>.</p> <p class="two"><strong>two-value syntax:</strong>.</p> <p class="three"><strong>three-value syntax:</strong>.</p> <p class="four"><strong>four-value syntax:</strong>.</p> </body> </html>