Why min-width and maximum-width hacks blow up in IE6
There are many hacks for ie6 to get the css properties min-width and maximum-width to work. Granted these hacks work. But what I can’t seem to find is a solution that doesn’t freeze the browser when you try to resize it. It’s been years and the problem sis still present. It doesn’t matter if you follow these instructions: “This important step is frequently omitted from many min/max-width tutorials, and is required to prevent Internet Explorer from freezing up and crashing.” – Perishable Press It will still crash when you follow those instructions and try to resize the window by stretching it.
Granted windows users are used to full screen, but its not always acceptable to have that instability.
Some Examples of these ie6 min-max hacks:
A Javascript Solution:
window.onload = checkAvailableWidth;
window.onresize = checkAvailableWidth;
function checkAvailableWidth(){
var container = document.getElementById("page");
container.style.width = (document.body.clientWidth < 959)? "959px" : "auto";
}
CSS Expressions:
The more common hack fom Andy Budd’s CSS mastery: http://www.cameronmoll.com/archives/000892.html
#container, #footer {
width: expression(document.body.clientWidth < 742? "740px" : document.body.clientWidth > 1202? "1200px" : "auto");
}
Related posts:
August 5th, 2009 at 7:52 am
Recently I discovered that at http://www.cameronmoll.com/archives/000884.html#004745 there is a solution in the comments thread. The trick is to use document.Element instead of document.Body