How to make <hr> line a different color? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to make <hr> line a different color?

I need some help to figure out how to turn the <hr> line black. I’ve tried <hr style=“color:black;”> and that didn’t work. I’ve also tried using CSS code “hr{color: black;}” and that didn’t work either.

25th Sep 2022, 12:59 AM
Lucas Pitirri
Lucas Pitirri - avatar
3 Answers
+ 2
Use "border" attribute to style hr elements. I have no idea why. See here: https://www.w3schools.com/howto/howto_css_style_hr.asp
25th Sep 2022, 1:23 AM
Emerson Prado
Emerson Prado - avatar
+ 3
hr{ color: red; }
27th Sep 2022, 5:00 PM
Alex
Alex - avatar
+ 1
Thank you so much! Its kind of weird you cant use color: black; Thank you again!
25th Sep 2022, 12:09 PM
Lucas Pitirri
Lucas Pitirri - avatar