PDA

View Full Version : [CSS] Gap at top of absolute div in Firefox & Opera - not IE!



YetiMan
February 13th, 2006, 09:56 AM
Hello folks, this is my first post - nice board! :D

I've got a problem that is really doing my head in. My web site - which you can see on my testing server here: http://shaftesbury.myftp.org/ywd/ - has a niggling problem with the main content.

You probably won't notice it, so I shall explain. Where it says "Welcome" followed by a little house icon, if you look closely (in FF or Opera) you will see there is a rather large (about 40 to 50px i'd say) gap from the top of the text to the top of the grey container. This should not be there. If you look using IE - the gap is only 20px, which is correct.

You can see where it should be in FF & Opera by looking at the top of the right-hand graphic that reads "professional web sites from just £400". The top of this graphic is lined up correctly (20px gap at the top).

Now, the outer container (<div id="main_container">) has position:relative. The container with the problem (<div id="main_text">) is nested inside, and has position:absolute. Can ANYONE figure out why FF & Opera display the gap whereas IE displays it correctly? It's doing my head in!

A quick fix would be to put main_text as position:relative or just have no position tag at all. However, this royally f**ks it up in Opera for some unknown reason.

Can anyone help me please? Thanks in advance!

YetiMan

antizip
February 13th, 2006, 10:10 AM
h1.home {
width: 250px;
margin-top:0px;
}

YetiMan
February 13th, 2006, 11:11 AM
h1.home {
width: 250px;
margin-top:0px;
}

Oh man.... that's so simple! *bangs head against desk*

That never even ocurred to me... I just assumed a heading would have no margin as default ??

Oh well.... it works fine now, thanks dude, you have reduced my blood pressure for sure :D

YetiMan

antizip
February 13th, 2006, 11:16 AM
no prob, those stupid margins give me headache-a-plenty. glad i could help. good day to you sir