By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,785 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,785 IT Pros & Developers. It's quick & easy.

h1 tag problem? why?

P: n/a
Hi,

Can anybody tell me how I stop the extra space my heading tags produce under
the text.
The space the tag is producing is throwing my layout out alot and I cant
figure how to remove it. If I change the line height ..the top of the text
is cut off...how do I do this?

Any advice is much appreciated

Sy
Jul 20 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Am 16.12.2003 23:28 schrieb Simon:
Hi,

Can anybody tell me how I stop the extra space my heading tags produce under
the text.


This should solve your problem:

h1 {
margin-bottom:0;
}

To remove any default whitespace use:

h1 {
padding:0;
margin:0;
}

Fabian
Jul 20 '05 #2

P: n/a

"Simon" <si***@digink.co.uk> skrev i meddelandet
news:2G*****************@newsfep3-gui.server.ntli.net...
Hi,

Can anybody tell me how I stop the extra space my heading tags produce under the text.
The space the tag is producing is throwing my layout out alot and I cant figure how to remove it. If I change the line height ..the top of the text is cut off...how do I do this?

Any advice is much appreciated


Try <H1 style="-5px;"> (negativ value)
But I don't know for sure how it validates or works in all browsers.

--
/Arne

Jul 20 '05 #3

P: n/a
in post <news:2G*****************@newsfep3-gui.server.ntli.net>
Simon said:
Can anybody tell me how I stop the extra space my heading tags produce under
the text.


margin-bottom:0;

--
brucie
17/December/2003 08:46:05 am kilo
Jul 20 '05 #4

P: n/a

"brucie" <br******@bruciesusenetshit.info> skrev i meddelandet
news:br************@ID-117621.news.uni-berlin.de...
in post <news:2G*****************@newsfep3-gui.server.ntli.net>
Simon said:
Can anybody tell me how I stop the extra space my heading tags produce under the text.


margin-bottom:0;


I belive you must use a negative value to get it realy "tight", i.e
margin-bottom:-5px;

--
/Arne
Jul 20 '05 #5

P: n/a
Arne wrote:
I belive you must use a negative value to get it realy "tight", i.e
margin-bottom:-5px;


No, that is stupid, since you could pull the element below over the H1
element. You should only use negative margins to 'design' not to remove
whitespace.
--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #6

P: n/a
Arne wrote:
Try <H1 style="-5px;"> (negativ value)
But I don't know for sure how it validates or works in all browsers.


This isn't the way to do it.

h1{
margin:0;
padding:0;
}

Is the way to go, as explained in other mails.
--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #7

P: n/a

"Anne van Kesteren" <ma**@annevankesteren.nl> skrev i meddelandet
news:br**********@reader08.wxs.nl...
Arne wrote:
I belive you must use a negative value to get it realy "tight", i.e
margin-bottom:-5px;
No, that is stupid, since you could pull the element below over the H1
element. You should only use negative margins to 'design' not to

remove whitespace.


I don't say you are wrong, but at least it works fine for me, tested
with IE 6.xx and Netscape 7.xx
Don't know about Opera and other.
--
/Arne
Jul 20 '05 #8

P: n/a

"Anne van Kesteren" <ma**@annevankesteren.nl> wrote in message
news:br**********@reader08.wxs.nl...
Arne wrote:
Try <H1 style="-5px;"> (negativ value)
But I don't know for sure how it validates or works in all browsers.


This isn't the way to do it.

h1{
margin:0;
padding:0;
}

Is the way to go, as explained in other mails.
--
Anne van Kesteren
<http://www.annevankesteren.nl/>

Thankyou Everyone :)

Sy
Jul 20 '05 #9

P: n/a
"Arne" <ar********@telia.com> wrote:
> I belive you must use a negative value to get it realy "tight",
> i.e margin-bottom:-5px;


No, that is stupid, since you could pull the element below over
the H1 element. You should only use negative margins to 'design'
not to remove whitespace.


I don't say you are wrong, but at least it works fine for me,
tested with IE 6.xx and Netscape 7.xx


It depends on your definition of "works". A negative bottom margin
means that the elements will partly overprint each other, if the next
element's top margin is zero. What this means depends on the context.
Making text lines touch (or even overprint) is usually not a good idea.

But maybe you mean that the next element has a nonzero margin. Then
that's the issue you should consider. Negative margins are a somewhat
clumsy way of addressing that problem.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #10

P: n/a

"Arne" <ar********@telia.com> wrote in message
news:1e********************@newsb.telia.net...
Can anybody tell me how I stop the extra space my heading tags produce under the text.


margin-bottom:0;


I belive you must use a negative value to get it realy "tight", i.e
margin-bottom:-5px;


Corect me if I'm wrong. Please.

But doesn't the UA only use the largest margin of the two when vertically
aligning block elements? So as long as you have a margin of 0, the margin
that occurs will be the one set or default for the other element (in this
case, a p seemingly)?
Jul 20 '05 #11

P: n/a
"Neal" <ne**@spamrcn.com> wrote:
But doesn't the UA only use the largest margin of the two when
vertically aligning block elements?
Not always. When a bottom margin is -5px and the next element's top
margin is 15px, the effective margin is 10px.
So as long as you have a margin
of 0, the margin that occurs will be the one set or default for the
other element (in this case, a p seemingly)?


Yes, if is zero or positive. But not when it is negative.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #12

P: n/a

"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message
news:Xn*****************************@193.229.0.31. ..
"Neal" <ne**@spamrcn.com> wrote:
But doesn't the UA only use the largest margin of the two when
vertically aligning block elements?


Not always. When a bottom margin is -5px and the next element's top
margin is 15px, the effective margin is 10px.
So as long as you have a margin
of 0, the margin that occurs will be the one set or default for the
other element (in this case, a p seemingly)?


Yes, if is zero or positive. But not when it is negative.


Wow. That's a little counter-intuitive. But thanks.
Jul 20 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.