Forum Moderators: open

Message Too Old, No Replies

No Space Between Headings

         

almo136

10:52 pm on Jan 2, 2009 (gmt 0)

10+ Year Member



Hi,

I would like to have a <h1> on one line and then a <h2> on the line directly below it.

Could someone tell me how this is done? I always get a default space.

Thanks.

tedster

11:54 pm on Jan 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The space is the result of default margins on the two elements. To make it absolutely no space between the lines, you can use css:

<h1 style="margin-bottom:0;">Main Headline</h1>
<h2 style="margin-top:0;">Subhead text</h2>

I prefer a bit of space, so I make those value around 4px or 6px, rather than 0. Note that you need to style both the h1 and h2, otherwise margin-collapsing rules will retain whichever margin is the larger.

almo136

2:21 am on Jan 3, 2009 (gmt 0)

10+ Year Member



perfect....thanks a million.