The border-color property is used to set the color of the four borders.
The color can be set by:
name - specify a color name, like "red"
HEX - specify a HEX value, like "#ff0000"
RGB - specify a RGB value, like "rgb(255,0,0)"
HSL - specify a HSL value, like "hsl(0, 100%, 50%)"
transparent
Note: If border-color is not set, it inherits the color of the element.
EXAMPLE
HTML
<!DOCTYPE html>
<html>
<body>
<h2>The border-color Property</h2>
<p>This property specifies the color of the four borders:</p>
<p class="one">A solid red border</p>
<p class="two">A solid green border</p>
<p class="three">A dotted blue border</p>
<p class="four">A dashed violet border</p>
<p class="five">A solid purple border (xd)</p>
<p class="six">A double brown border</p>
<p class="seven">A groove yellow border</p>
<p class="eight">A ridge black border</p>
<p class="nine">A inset grey border</p>
<p class="ten">A outset cyan border</p>
<p class="eleven">A none white border</p>
<p class="twelve">A hidden black border</p>
<p class="thirteen">A dotted dashed solid double pink border</p>
<p><b>Note:</b> The "border-color" property does not work if it is used alone. Use the "border-style" property to set the borders first.</p>
</body>
</html>
CSS
p.one {
border-style: solid;
border-color: red;
}
p.two {
border-style: solid;
border-color: green;
}
p.three {
border-style: dotted;
border-color: blue;
}
p.four {border-style: dashed;
border-color: violet;
}
p.five {border-style: solid;
border-color: purple;
}
p.six {border-style: double;
border-color: brown;
}
p.seven {border-style: groove;
border-color: yellow;
}
p.eight {border-style: ridge;
border-color: black;
}
p.nine {border-style: inset;
border-color: grey;
}
p.ten {border-style: outset;
border-color: cyan;
}
p.eleven {border-style: none;
border-color: white
}
p.twelve {border-style: hidden;
border-color: black;
}
p.thirteen {border-style: dotted dashed solid double;
border-color: pink;
}
The border-color property has a range of one to four values (for the top, right, bottom, and left borders).
EXAMPLE
HTML
<!DOCTYPE html>
<html>
<body>
<h2>The border-color Property</h2>
<p>The border-color property can have from one to four values (for the top border, right border, bottom border, and the left border):</p>
<p class="one">A solid multicolor border</p>
<p class="two">A solid multicolor border</p>
<p class="three">A solid multicolor border</p>
<p class="four">A solid multicolor border</p>
</body>
</html>
CSS
p.one {
border-style: solid;
border-color: red green blue yellow;
}
p.two {
border-style: solid;
border-color: yellow red green blue;
}
p.three {
border-style: solid;
border-color: blue yellow red green;
}
p.four {
border-style: solid;
border-color: green blue yellow red;
}