views:

1079

answers:

2

Does anyone know if IE6 ever misrenders pages with hidden divs? We currently have several divs which we display in the same space on the page, only showing one at a time and hiding all others.

The problem is that the hidden divs' components (specifically option menus) sometimes show through. If the page is scrolled, removing the components from view, and then scrolled back down, the should-be-hidden components then disappear.

How do we fix this?

+3  A: 

One hack you could use is to move your div outside the screen:

MyDiv.style.left = "-1000px";

And then put it back on its original position when you want to show it.

santiiiii
Cheers for the idea. I can see why this should work, but for some reason it's not. Even trying style.left = "-10px"; didn't budge it.
I've used this technique myself and works great in IE 6.0, but I think your div needs to be absolutely positioned; it may not work otherwise.
santiiiii
Did as you suggested and changed the div (and its parent) to absolutely positioning. Works now, thanks!
+2  A: 

How are they hidden? using "display:none;" or "visibility:hidden;" ? are they absolutely positioned by any chance? IE6 has a z-Index problem and there are several hacks to deal with it.

Eran Galperin
They are hidden using "display:none;" - I'll try "visibility:hidden;" if it will help. They are absolutely positioned, any hacks to fix this would be much appreciated.
Is it contained in another absolutely or relatively positioned div?
Eran Galperin
Within another absolutely positioned div, cheers.
You need to make sure both divs 'hasLayout' attribute is set. Read this article on this particular IE caveat - http://www.satzansatz.de/cssd/onhavinglayout.html
Eran Galperin