View video tutorial

CSS Border Color

CSS

This specifies the color of border.

CSS border-color property

The border-color property specifies the color of the border of an element.

Any color value is fine for the border-color property.

Example

.p1 {
  border-style: solid;
  border-color: red;
}
.p2 {
  border-style: solid;
  border-color: rgb(255, 0, 0);
}
.p3 {
  border-style: solid;
  border-color: #ff0000;
}
.p4 {
  border-style: solid;
  border-color: hsl(0, 100%, 50%);
}
Try it Now »

Click on the "Try it Now" button to see how it works.


Sample Code

Copy each file contents and paste it to your own project and run to see the final output

border-color: black red green blue;

Here, top:black. right:red. bottom:green. left:blue.

border-color: black red;

Here, top:black. right:red. bottom:black. left:red.

Example

.p1 {
  border-style: solid;
  border-color: black red green blue;
}
.p2 {
  border-style: solid;
  border-color: black red;
}
Try it Now »

Click on the "Try it Now" button to see how it works.