...

View Full Version : Removing margin before first H1



don
01-21-2005, 05:19 PM
Firefox puts a space before all H1 tags, including the first. IE doesn't.

Is there a better way to handle that than to do this? I'd rather not do it like this on every page.

<h1 style="margin: 0">First Header1</h1>
<h1>Other Header1</h1>

rmedek
01-21-2005, 07:55 PM
h1 {
margin: 0;
}


<h1>First header, most important</h1>
<h2>Other header, not quite as important</h2>
<p>Remember to code semantically!</p>

hemebond
01-21-2005, 08:57 PM
Just to clarify what rmedek is saying, you should only have one H1 in your document. And it would usually be your site name.

don
01-22-2005, 01:19 AM
Gotcha.

Thanks.

Graft-Creative
01-22-2005, 01:48 AM
Or if you wanted to dispense with having to deal with different browsers assigning different margins/padding to elements, you could always try this:



* {
margin: 0;
padding: 0;
}


Though I've not tried it myself yet :rolleyes:

Gary

rmedek
01-22-2005, 03:37 AM
I learned that trick from Andrew (mindlessLemming)... that is the "MOST AWESOME CSS TIP EVER" :D. It certainly saves a lot of hassle.

chilipie
01-22-2005, 09:35 AM
I learned that trick from Andrew (mindlessLemming)... that is the "MOST AWESOME CSS TIP EVER" :D. It certainly saves a lot of hassle.
It sure do... ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum