# problem with IE6 / div margins



## lamialex (Oct 29, 2007)

Hello,

I'm building a very simple website which works fine on Firefox and IE7 but on IE6 and under, there's a small bug within the design layout and needless to say that this is very annoying and I have tried to fix that for several hours now... 

the link for my website :

http://www.lamialex.streamlinenettrial.co.uk/

You'll see on IE6 that on the right of the middle frame there's a bug, the frame is wider than it is supposed to be.

Here is the code and after few tests I know which div bugs :

The html page :


```
<body>
<div id="frame">

<img src="images/topframe.png" width="800" height="8" alt="picture for the top of the frame" />

<div id="insideframe">

...
```
It's the div insideframe that is causing problems, here is its style :


```
#insideframe {width: 800px; margin-left: 8px; margin-right: 8px; padding: 0;}
```
On IE6, the div "insideframe" is wider than 800px which causes the problem, if I remove margin-left and margin-right, it is now 800px width but then there is no margin-left which I really need.

It seems like it's adding another margin left and right but only on the right of the frame. On the left side, the margin left is correct : 8px.
So I thought it was the IE6 double margin bug and I used display:inline; but it doesn't work, it's even worse so this is not the problem.

I'm sure I could put that margin-left and margin-right I need on other divs but I'd really like to understand this bug.

If anyone has an idea that would be great, I will listen to any suggestions 

Alex


----------



## Fyzbo (Feb 6, 2002)

it's not the double margin. #insideframe is actually 816px wide. 800px width + 8px marginleft + 8px marginright. In ie7, firefox, etc. standards are followed and extra flows out of the container. In IE6 the container is stretched to compensate for the 816px.

I would change the width of #insideframe to 784px.

Firebug is very useful for this as you can highlight the div's and see where they fall on the page. There is also the ie developer toolbar with similar features.


----------



## lamialex (Oct 29, 2007)

Thanks a lot for your help :up:
I put width to 784px and it did work, although IE6 didn't seem to like that margin-right set at 8px so I had to remove it but it didn't change the layout so it's all good 
Thanks also for the firebug tip.


----------

