PDA

View Full Version : <hr> colors?



trenzterra
October 23rd, 2002, 23:15
You know the <hr> color attribute isn't supported on netscape and opera, is there an alternative instead of using images?

aphel aura
October 24th, 2002, 12:57
No.

Or maybe you can tell your visitors to use IE:) :) :) :D

Dusty
October 24th, 2002, 13:37
You could use CSS, but that will leave out older browsers. Alternatively, you could use a table, but unless you want an exceptionally wide rule you'd need at least a small image (like a single transparent pixel that you can resize to whatever size is needed).

CSS:

This works in Mozilla, Netscape 6.x>, and Opera:

<hr style="background-color:#######" width="100%">

You'll either want to set the border to zero or get rid of the shading, otherwise there'll be a gray border around it.

(This method doesn't work in IE, it's <hr> color style is controlled by "color" (which is incorrect and an error on their part, but anyway...).)


Table way:

This should work in any browser that supports table:

<table border="0" cellpadding="0" cellspacing="0" align="center" width="100%"><tr><td bgcolor="#######">&amp;nbsp;</td></tr></table>

As was said, this will result in a very wide rule. To make it smaller you could replace the "&amp;nbsp;" with something like "<img src='pixel.gif' width='1' height='3'>", where pixel.gif is just a single pixel, transparent image.

Ashed
October 24th, 2002, 15:57
Nice, I really like the table way.
And I agree with aphel aura, tell them to use IE... :D

Bruce
October 24th, 2002, 16:12
Originally posted by GRiN
And I agree with aphel aura, tell them to use IE... :D If people are already smart enough to not use IE, I'm sure they'll be smart enough to ignore foolish comments liek that.

merickson
October 24th, 2002, 20:36
Use a pixel shim.
Create a 1X1 gif of the correct color, set the size with the width and height attribute of the img tag. Transparent pixel shims are realy useful.

Bruce
October 24th, 2002, 20:37
Yes, spacers can be quite useful.

trenzterra
October 24th, 2002, 21:43
won't it result a ugly image if that person has images turned off?

aphel aura
October 25th, 2002, 03:38
Only if the "Show image download placeholders" is turned on.