Nathan Pitmanhello, my name is
nathan pitman.

Styling Horizontal Rules with CSS Oct 26. 041

Tip of the day… don’t waste hours trying to style Horizontal Rules consistently in different browsers. Instead wrap your HR in a div, set the HR to

displaynone
and style the surrounding div instead.

div.horRule {
 height
1px;
 
border-top1px solid #E5E5E5;
 
margin-top3px;
 
margin-bottom3px;
 
margin-left10px;
 
margin-right10px;
}
div
.horRule hr {
 display
none;
}

If a user is browsing your site with a device that doesn’t support CSS then they’ll still see the standard HR.

Tagged: Code

Very neat effect – thanks!

Posted by Bojan Sala on 26/10/2004 at 03:59 PM

Speak your mind

Name:

Email:

Location:

URL:

Remember my personal information

Notify me of follow-up comments?

Submit the word you see below: