margin-bottom not consistant with browsers

A

alice

I've got a div with a bottom margin of 12px. In IE7, the margin is in
fact 12 px, but in Firefox, it's 30 px. Can someone tell me what's
going on here and what I can do about it? I'm pretty sure it's not an
issue along the lines of "Firefox adds 18 px to all bottom margins",
so what type of issue is this?
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Sat, 04 Aug 2007 00:05:04 GMT
alice scribed:
I've got a div with a bottom margin of 12px. In IE7, the margin is in
fact 12 px, but in Firefox, it's 30 px. Can someone tell me what's
going on here and what I can do about it? I'm pretty sure it's not an
issue along the lines of "Firefox adds 18 px to all bottom margins",
so what type of issue is this?

Probably an extra LF/CR from some source or t'other. Look for <br>s, esp.
at end or beginning of containers and how text flows therewithin.
 
B

Ben C

I've got a div with a bottom margin of 12px. In IE7, the margin is in
fact 12 px, but in Firefox, it's 30 px. Can someone tell me what's
going on here and what I can do about it? I'm pretty sure it's not an
issue along the lines of "Firefox adds 18 px to all bottom margins",
so what type of issue is this?

Could be margin-collapsing, which IE7 might get wrong (it is a little
complicated to understand). What kind of bottom margin does the div's
container have, and does the container also have zero bottom padding and
border?

This would give the effect you describe for example:

<body>
<div style="margin-bottom: 30px; background-color: red;">
<div style="margin-bottom: 18px; background-color: lavender">
Hello
</div>
</div>
world
</body>

You shouldn't be able to see any red, and there should be 30px between
the bottom of "Hello" and the top of "world".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top