CSS Border Color

Itacen Sabacok | May 5, 2021

border-color

NOTE

The colors can be set like below:

  • name - with specific name, like “blue” or “blue yellow red”
  • HEX - with a HEX value, like “#ff4706”
  • RGB - with a RGB value, like “rgb(81, 110, 205)”
  • HSL - with a HSL value, like “hsl(6, 18%, 47%)”
  • transparent

If border-color is not set, it inherits the color of the element

 1p {
 2  border-style: solid;
 3  border-color: red yellow blue green; /* red top, yellow right, blue bottom and green left */
 4}
 5
 6div {
 7  border-style: inset;
 8  border-color: #ff4700;
 9}
10
11span {
12  border-style: dotted;
13  border-color: rgb(91, 210, 255);
14}
15
16div {
17  border-style: groove;
18  border-color: hsl(6, 48%, 57%);
19}

Sample Output

border-color: red yellow blue green

border-color: #ff4700

border-color: rgb(91, 210, 255)

border-color: hsl(6, 48%, 57%)