Forum Moderators: mack

Message Too Old, No Replies

HR CSS or HTML

CSS for Site HTML for one object

         

HeadBut

3:47 pm on Jun 22, 2006 (gmt 0)

10+ Year Member



What is the CSS for thickness of the HR ellement. I keep getting a javaconsole error(Firefox) with size, and height. I'd like to set it to 5 pixels and I've tried these with 5px but I get an error in the java console. I'd know I can set it with HTML (Size=5) but I'd like to change the whole site. Is this the correct approach?

limbo

3:56 pm on Jun 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd use padding¦border¦margin on the block element you require the HR to follow instead of the <hr> tag. CSS supppoort for HR is sketchy at best.

HeadBut

4:03 pm on Jun 22, 2006 (gmt 0)

10+ Year Member



so: { border-width: 5 px;} should work?

choster

6:28 pm on Jun 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Setting margin-width to 5px will create a 5px border on all four sides, and I believe you still need to specify height. Try

hr {height: 5px; border: solid #000; border-width: 5px 0 0}

encyclo

2:06 am on Jun 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the horizontal rule is presentational, then you are often better-off adding a bottom border to the preceding block element (or a top border to the following element) and doing away with the
hr
completely.

.line {
margin-bottom:1em;
border-bottom:5px solid #000;
}

<p class="line">preceding paragraph</p>
<p>following paragraph</p>

pageoneresults

2:08 am on Jun 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This is what I've been using...

hr{height:0;border:0;border-top:1px solid #999;}

I think I picked that up from one of the CSS guru sites. Might have even been here at WebmasterWorld. ;)