border color

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

CSS border-color Property


Set the color of the four borders:

    border-style: solid;
    border-color: #ff0000 #0000ff;



Definition and Usage

The border-color property sets the color of an element's four borders. This property can have from one to four values.


  • border-color:red green blue pink;
    • top border is red
    • right border is green
    • bottom border is blue
    • left border is pink
  • border-color:red green blue;
    • top border is red
    • right and left borders are green
    • bottom border is blue
  • border-color:red green;
    • top and bottom borders are red
    • right and left 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 borders before you can change the color.


CSS Syntax

border-color: color|transparent|initial|inherit;

Property Values

Value Description  
color Specifies the background color. Look at CSS Color Values for a complete list of possible color values. Default color is black  
transparent Specifies that the border color should be transparent