Welcome to WebmasterWorld Guest from 107.20.75.63

Forum Moderators: not2easy

Message Too Old, No Replies

changing line break height for <h1> or <p>

block elements creating too much space with line breaks

     
8:48 pm on Aug 29, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 11, 2005
posts:386
votes: 0


Quick question folks...

how do you alter how large the line break is between something like <h1> and whatever comes after it? My design is leaving too much space between the heading element and the element below it. I attempted to change line-height value of the <h1> tag, but that didn't work.

8:52 pm on Aug 29, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 20, 2005
posts:86
votes: 0


h1,h2,h3,h4 {margin:0;}
8:53 pm on Aug 29, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Apr 12, 2005
posts:371
votes: 0


Don_Hoagie,

If you are talking about the vertical space between the H1 and the line below it, then the following should do the trick:

<H1 style="margin-bottom:3px;">stuff</h1>

The default for H1 tags is about a 21px margin, you can set this to whatever you want.

Chad

11:25 pm on Aug 29, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 11, 2005
posts:386
votes: 0


Ah. I was under the impression that adding a margin would simply add more space to the default whitespace set up by headings... if anything, I wouldve thought that a negative margin would be the answer.

But apparently, it is not.

Thanks for your help, both'uh'yous!

11:41 pm on Aug 29, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


Right -- browsers already applying a default margin to those elements, so you just need to override it with your css.

One key is that both an element and its following element may already have default margins, so you may need to override BOTH the margin-bottom for the first element and the margin-top for the following element.Otherwise the margin collapsing rules that browsers use will still apply the larger of those two margins.