Forum Moderators: not2easy

Message Too Old, No Replies

Firefox does not apply margin to first div

Firefox 1.5.0.10 does not apply margin to first div but IE6 does.

         

paul_f

1:37 pm on Mar 20, 2007 (gmt 0)

10+ Year Member



Why does firefox apply the margin-top to <div>box3</div> but not to <div>box2</div>? IE applies the margin-top to both as expected.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
<!--

html, body, ul, ol, li, p, h1, h2, h3, h4, h5, h6, form, fieldset, div {
margin: 0;
padding: 0;
border: 0;
}

div h2
{
border: 2px solid;
}

fieldset div
{
clear: both;
margin-top: 10px;
border: 1px solid;
}

-->
</style>
</head>
<body>
<div>
<h2>box1</h2>
<fieldset class="signIn">
<div>box2</div>
<div>box3</div>
</fieldset>
</div>
</body>
</html>

Setek

12:52 am on Mar 21, 2007 (gmt 0)

10+ Year Member



Using your example, I have both IE 6, IE 7, Firefox 2 (Win & OS X,) Safari 2 and Opera 9.1 (Win & OS X) all displaying exactly the same, with the top margin being applied.

Are you sure there is no other code you accidentally stripped out?

londrum

8:58 pm on Mar 25, 2007 (gmt 0)

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



firefox collapses margins as well, so if you have two boxes, one with a margin-bottom of 10px and the other with margin-top:10px, then you will still only get 10px between them, not 20.
i think IE6 gives you 20 though.
is it something to do with that?