Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't <hr />'s colour change?

Tags:

html

css

I've got the following...

 <hr style="color:#292929;background-color:#292929;"/>

but the colour isn't changing to the HTML colour code I've declared. Why not?

like image 970
Skizit Avatar asked Sep 21 '10 21:09

Skizit


6 Answers

Set border-color.

like image 66
Jon B Avatar answered Nov 04 '22 13:11

Jon B


the hr tag is a bit tricky vs other elements to style. Which things work and which ones don't is very browser dependent.

A cache of tricks (including coloration) is available here: http://webdesign.about.com/od/beginningcss/a/style_hr_tag.htm

like image 20
ford Avatar answered Nov 04 '22 14:11

ford


  1. Try giving it a height like 5px;
  2. Give it your border styles but with 0px width.
  3. Re-apply a 1px width to either top or bottom:

Result:

<hr style="height: 5px; border: 0px solid #D6D6D6; border-top-width: 1px;" />
like image 42
Gilly Avatar answered Nov 04 '22 15:11

Gilly


instead of: color:#292929;

use: border-color:#292929;

like image 29
Sagiv Ofek Avatar answered Nov 04 '22 14:11

Sagiv Ofek


just use a p tag with border, above unswers give no result for me...

<p style="border-bottom: 1px solid #D6D6D6; padding-bottom: 20px; margin-bottom: 20px"></p>

like image 25
den_ban Avatar answered Nov 04 '22 15:11

den_ban


Try styling the border instead

like image 30
Dave Hogan Avatar answered Nov 04 '22 14:11

Dave Hogan