PDA

View Full Version : <HR> tag in CSS


harv
01-01-2002, 09:47/09:47AM
I believe you can vary the thickness of the
horizontal bar in CSS but I cannot find the
option to do this .

Can someone advise please ?

Thanks
Harvey

ihelpyou
01-01-2002, 12:21/12:21PM
Hi harv, I have not seen this in a css file but maybe someone can help. My answer would be no.

Advisor
01-01-2002, 12:21/12:21PM
I don't know about CSS but with regular html you can change the height and/or width of the horizontal rule.

It's simply:

<hr height="5"> (or whatever height (thickness) you want). Can do the same thing with the width (length). I'm doing this from memory, but I think that's the code.

Good luck!

Jill

ihelpyou
01-01-2002, 12:28/12:28PM
Maybe try this harv,

<!--

body (
HR : 5;
HR-color : blue;
)

-->

or, make it ... HR-height : 5;

harv
01-01-2002, 12:46/12:46PM
Thanks Jill and Doug,

"height" is the answer


Harvey

ihelpyou
01-01-2002, 12:54/12:54PM
Okay, so which way worked? I am curious.

harv
01-01-2002, 13:05/01:05PM
Originally posted by ihelpyou
Okay, so which way worked? I am curious.

Doug, this is what I have used

hr {
margin: 20px 0px 10px 0px;
height: 4px;
background: red;

}

Advisor
01-01-2002, 13:07/01:07PM
CSS is sooooooo cool!

J

ihelpyou
01-01-2002, 13:28/01:28PM
Good deal harv! I never knew css could handle that with hr. I am sure that the world web contorium will not recognize it but if browsers do, then it is just fine. :)

Just like the css tag in these forums. The scroll bar tags do not conform to standards but it works! :)

harv
01-01-2002, 13:40/01:40PM
Originally posted by ihelpyou
. I am sure that the world web contorium will not recognize it but if browsers do, then it is just fine.


It is acceptable to the W3C CSS Validator at
http://jigsaw.w3.org/css-validator/validator-uri.html


Harvey

countrycat
14-01-2002, 11:31/11:31AM
This thread worked great for my HR tags on one of my pages. However, I find that NS automatically puts the HR aligned left while Explorer centers it.

I tried including an align: center; specification in my STYLE specs, but it doesn't work.

Any suggestions? I can always add it to the HR tag itself, but I'm trying to force myself to stay away from deprecated attributes and tags as much as possible.

Thanks!

harv
14-01-2002, 12:07/12:07PM
Originally posted by countrycat
I can always add it to the HR tag itself

Not sure what you mean by this - what is the alternative ?

However, the margin tag will center the line for you.


Harvey

countrycat
14-01-2002, 14:50/02:50PM
If I include either alignment: center or text-align:center inside the style specification, NS and IE both ignore it.

In NS, the HR is always left-aligned and in IE, it's always centered.

The only way I can get the thing to be either left-aligned or right-aligned in IE is with a DIV tag - which NS ignores.

Now, this is all using CSS. I can use straight HTML instead <HR align=left, height="5"> etc. But in HTML 4, all attributes to the HR tag are deprecated.

But there must be some way of reliably aligning a HR in CSS. Or do I expect too much from CSS?

And I'm sorry, I don't understand about using a margin tag to align. I use margin to add transparent space between elements. Is there a way to set alignment with it as well?

harv
14-01-2002, 14:59/02:59PM
Originally posted by countrycat
And I'm sorry, I don't understand about using a margin tag to align. I use margin to add transparent space between elements. Is there a way to set alignment with it as well?

Yes, for example

margin: 10px 100px 10px 100px;


Harvey

countrycat
14-01-2002, 15:18/03:18PM
DUH! I'm an idiot!

I see what you mean. Thanks!