Forum Moderators: open

Message Too Old, No Replies

<h1> tag

disabling h1 space

         

fashezee

4:47 pm on Oct 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We all are all awartr of the space H1 tag automatically giving itself line space
when inserted in a page. Is there a method of disabling that space?

Alternative Future

4:49 pm on Oct 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is it not: -
display:inline

Someone else is sure to correct me if i am wrong :)

-gs

fashezee

5:04 pm on Oct 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks..
That did the trick ....

tedster

5:11 pm on Oct 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Because the H1 element is by default display:block, it automatically has both a line break and a larger margin than, say, a regular <p> element.

Switching to display:inline eliminates both the line break and the margin, which may not always be the effect you want. You can maintain the line-break by staying with the default display of block, but writing a rule to change margin-bottom: to a smaller amount.

dazz

9:13 pm on Oct 21, 2003 (gmt 0)

10+ Year Member



So..say you have your line saying -

<h1><font face="Verdana" size="2">this is my main title</font></h1>

Where does display:inline go?!

killroy

9:29 pm on Oct 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Erm try

<h1 style="display:inline;font-family:verdana;font-size:1.2em">Title</h1>

Instead...

FONT tags have been discontinued a long time ago.

SN

aevea

1:42 am on Oct 22, 2003 (gmt 0)

10+ Year Member



Ive played around with using
display: inline;
on
<h1>
tags and for me they became really hard to handle (position). I prefer:

h1 {margin: 0; padding: 0; font: 2em/1em verdana, arial, sans-serif;}

You still have the break afterwards, but you can control the line-height with the second value on the font declaration. You can declare it inline like killroy's example, or link it to your pages in a stylesheet (as above) so it applies to all your

<h1>
s.

Adam

Mark_A

2:04 am on Oct 22, 2003 (gmt 0)

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



this sort of thing works also in your css file

H1 {
font-size: whatever;
font-family: Arial, sans-serif;
color: gaudy whatever;
margin-top: 5px;
margin-right: 5px;
margin-left: 5px;
margin-bottom: 5px;
}

g1smd

8:36 pm on Oct 22, 2003 (gmt 0)

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



<h1><font face="Verdana" size="2">this is my main title</font></h1>

<h1 style="display:inline;font-family:verdana;font-size:1.2em">Title</h1>

Inline styles (i.e. style information inside HTML tags) is just as much code bloat as the old HTML attributes that it replaces.

Export all of your CSS information to external stylesheet files, and benefit from smaller, faster loading HTML files, and reusable CSS information that can be made common to every single page of the site.