# Firefox is interpreting 'margin' the wrong way

**URL:** <https://forum.kirupa.com/t/firefox-is-interpreting-margin-the-wrong-way/262306>\
**Category:** web dev\
**Created:** [June 4, 2008, 9:12pm UTC](https://forum.kirupa.com/t/firefox-is-interpreting-margin-the-wrong-way/262306 "2008-06-04T21:12:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanel96](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@tanel96](https://forum.kirupa.com/u/tanel96)\
**Post date:** [June 4, 2008, 9:12pm UTC](https://forum.kirupa.com/t/firefox-is-interpreting-margin-the-wrong-way/262306/1 "2008-06-04T21:12:32Z")

</div>

In IE everything is fine, but in firefox… the inner div is not 100px away from the outer div’s border… it’s sitting right next to it… and firefox is applying the 100px margin to the top of the page… not the containing div… how to get rid of this ?

```auto

<body>
<div style="background-color:#0066CC; height:600px;"><div style="margin-top:100px;">inner div</div></div>
</body>

```

---

<div class="post-metadata">

**Author:** ![Templarian](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/templarian/32/7152_2.png) [@Templarian](https://forum.kirupa.com/u/Templarian)\
**Post date:** [June 4, 2008, 9:47pm UTC](https://forum.kirupa.com/t/firefox-is-interpreting-margin-the-wrong-way/262306/2 "2008-06-04T21:47:42Z")

</div>

```auto
<div style="background-color:#0066CC; height:600px;padding-top:100px;"><div>inner div</div></div>

```

```auto
<div style="background-color:#0066CC; height:600px;"><div style="position:absolute;top:100px;width:100%;">inner div</div></div>

```

Theres a few ways to do it.

---

<div class="post-metadata">

**Author:** ![fasterthanlight](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fasterthanlight](https://forum.kirupa.com/u/fasterthanlight)\
**Post date:** [June 4, 2008, 9:54pm UTC](https://forum.kirupa.com/t/firefox-is-interpreting-margin-the-wrong-way/262306/3 "2008-06-04T21:54:06Z")

</div>

yea but it should work with just margin-top: 100px; on the inner div… can you post a link to the html on a server tanel96?

---

<div class="post-metadata">

**Author:** ![tanel96](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@tanel96](https://forum.kirupa.com/u/tanel96)\
**Post date:** [June 5, 2008, 8:51am UTC](https://forum.kirupa.com/t/firefox-is-interpreting-margin-the-wrong-way/262306/4 "2008-06-05T08:51:28Z")

</div>

[http://fritz.planet.ee/margin.html](http://fritz.planet.ee/margin.html) here it is… everything is fine in IE… the white div is offset properly, but in FireFox… the white div is right at the top… AND the offset is calculated from the top of the page.

I know the code does not validate… it’s just to show you the problem.

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [June 5, 2008, 1:27pm UTC](https://forum.kirupa.com/t/firefox-is-interpreting-margin-the-wrong-way/262306/5 "2008-06-05T13:27:59Z")

</div>

```auto

<div style="background-color:#0066CC; height:600px;">

```

==

```auto

<div style="background-color:#0066CC; height:600px; overflow: hidden;">

```

OR optionally

```auto
<div style="margin-top:100px; float: left;">inner div</div>

```
