Log in

View Full Version : XHTML and <hr> tag



nihalz
08-20-2007, 05:17 PM
hi
i am trying to use the <hr> tag in a XHTML page...
at first i used this

<hr color="blue">
but when i tried to validate the code at w3.org, i got the error that

there is no attribute "color"
so after some researching i found that i had to use the style attribute to give a color...so i did that...

<hr style="color:blue; size:2px;" />
but now there is no color on the horizontal line and i am also not able to change the height of the horizontal line either using the size attribute or the style attribute..
what am i doing wrong?
any suggestions?
thanks!

EDIT: I just found out that it works in IE6 but not in FF..which came as a surprise to me...anyone know how to make it work in FF?

Twey
08-20-2007, 05:28 PM
i am trying to use the <hr> tag in a XHTML page...Don't -- stick with HTML 4.01 Strict. XHTML isn't yet supported by IE.
so after some researching i found that i had to use the style attribute to give a color...so i did that...Try border-color, and don't style things inline -- use an external stylesheet.

boogyman
08-20-2007, 05:31 PM
or possibly background-color

naiani
08-20-2007, 05:31 PM
I think the best solution is actually applying borders to the hr, so you can customize it the way you want (colors, size, style, etc).
Try applying borders and changing its background-color.

nihalz
08-20-2007, 08:16 PM
thanks a lot guys
i can give color to the line by using 'background-color'...though its still kinda weird why the color attribute doesn't work..
tnx anywayz

boogyman
08-20-2007, 08:59 PM
the css color selector is used for text, not the background

djr33
08-21-2007, 12:00 AM
I believe the use of color and background-color for the hr tag differs by browser. Not sure on the details.