background-color: ***;

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O

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

The color of the horizontal rule can be specified by applying this property to the HR element.


hr {
background-color: red;
border: none;
height: 3px;
}

Property Value Explanation
background-color color code or name the background color of the horizontal rule

Example


<html>
<head>
<title>TAG index</title>

<style type="text/css">

hr.example1 {
background-color: #ff0000;
height: 10px;
}

hr.example2 {
background-color: #0000ff;
border: none;
height: 1px;
}

</style>

</head>
<body>

<hr class="example1">

<hr class="example2">

</body>
</html>

Output