CSS for horizontal rules?

liunx

Guest
Can I apply CSS to change the color/thickness of an <hr> tag?Why use an <hr> tag when you could just apply a bottom or top border to an already existing element?If I did use borders for the element in question (an <h5> tag) I'd need two seperate classes, depending on where the heading is on the page. If I use an <hr> tag, I simply have one CSS rule to deal with, and <hr> is less typing than class="start" or class="end" anyways.A horizontal rule is just a line, so just one class would do it surely. However if you still want to style an <hr> you can do it like this:<style type="text/css">

hr{
height:0.5em;
width:60%;
margin:0 auto;
border:1px outset #f00;
background-color:#f00;
}

</style>Thanks. The reason I'd need two classes is because I have a definition list, which has a border on the top and bottom. Sometimes the header appears above the list, sometimes below it.
 
Back
Top