homepage Welcome to WebmasterWorld Guest from 54.237.38.30
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
changing line break height for <h1> or <p>
block elements creating too much space with line breaks
Don_Hoagie

5+ Year Member



 
Msg#: 7359 posted 8:48 pm on Aug 29, 2005 (gmt 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.

 

Prolific

5+ Year Member



 
Msg#: 7359 posted 8:52 pm on Aug 29, 2005 (gmt 0)

h1,h2,h3,h4 {margin:0;}

ChadSEO

5+ Year Member



 
Msg#: 7359 posted 8:53 pm on Aug 29, 2005 (gmt 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

Don_Hoagie

5+ Year Member



 
Msg#: 7359 posted 11:25 pm on Aug 29, 2005 (gmt 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!

tedster

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



 
Msg#: 7359 posted 11:41 pm on Aug 29, 2005 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved