I am trying to change the color of <hr>
line using the normal CSS code, but it is not working
hr{ color:yellow; //not working }
but it is not working, how can I achieve it using CSS?What am I missing here?
You can style <hr> using CSS below
hr { background-color: yellow; height: 1px; border: 0; }
Or Another solution
hr{
border: 1px solid yellow;
}
Remember,border-color
works in Chrome and
Safari
background-color
works in Firefox and Opera
color
works in IE7+
hr {
height: 1px;
color: yellow;
background-color: yellow;
border: none;
}
Try the above solution it will work for sure.
Also if you want to show your <hr> in various other designs, take a look at this URL, it has quite amazing designs with code
Try using Border-top in CSS for changing hr color
hr {
border-top: 1px solid red;
}
This is the easiest way.
OR
To keep hr 1px thick with changed color, you can try below CSS
hr {
height: 0;
border: 0;
border-top: 1px solid red;
}
This should help.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly