For some reason IE doesn't like me using max-width in a DIV... I found this as an alternative online: max-width:800px; width:expression(document.body.clientWidth > 800? "800px": "auto" ); Code (markup): This raises the javascript alert though... Does anyone know of a way to use min-width and max-width in IE without javascript? Thanks guys...
IE < 7 doesnt have support for max-width or min-width property. Or even for max-height or min-height for that matter. Expressions should work fine. As far as alerts are concerned, they are raised only when you try opening a page locally which contains javascript code. Regards, -- Naif
As naif said, Internet Explorer 5.x and 6 don't support min/max-width/height (though they will treat height as min-height unless you force its proper behavior using overflow: hidden), so you will have to use an expression or an external JavaScript function that gets served only to Internet Explorer ( using if(document.all && document.getElementByID()) { } ) won't cut it, since some browsers such as Opera when identifying or masking itself as IE as well as Konqueror can understand document.all). When using an expression though, it's best to serve it separately to Internet Explorer 6 either through the Star HTML hack ( * html #selector ) or via a separate stylesheet served by a conditional comment.
Which is why I do it thus: http://forums.digitalpoint.com/showpost.php?p=4847396&postcount=3 You'll notice I also set a fixed width before the expressions - that way if the script fails you still have it constrained at a useful size.