views:

283

answers:

2

Hi, I have the following

<div id=A style='height: 120px;'>
  <div id=B style='height: 100px;'>
    <div id=D style='height:  60px; top 0px; position: relative;'>Stuff D</div>
    <div id=E style='height:  80px; top: -40px; position: relative;'>Stuff E</div>
  </div>
  <div id=C style='height:  20px;'>Footer</div>
</div>

In browsers other than IE6, this works fine. However, IE6 adds the heights of D & E to 140 and forces B to become 140 which pushes down C by 40. However, the top of E is rendered 40px overlapping D as it should. It's just the box for B becomes the 140 high only in IE6.

What can I do with the CSS/HTML to make IE6 behave without affecting other browsers which get it and keep B at 100px?

+1  A: 

It's not the fact that the heights are added up beforehand that's messing you up---all browsers do this. It's the fact that IE 6 has a different idea of what to do when the height of #B's content exceeds 100px. Since you know the height you want for #B, you can add overflow: hidden to the existing style.

<div id="B" style="height: 100px; overflow: hidden;">
David Kolar
A: 

I found that margin-top: -??px; will do the same thing as just top: -??px does. Thanks for the assistance. I will be trying the overflow: hidden and the !important, because they sound interesting.

If you can do it without negative margins, it'll probably make your life easier. They can create some pretty nasty layout bugs.
Pat
To combat another bug (too much to go into now) I could not position the images divs "absolute"ly so I had to do "position:relative" and a negative top (well margin-top now) value to get them to overlap.