CSS Max Width Image Probem IE7
10/08/09 06:57 PM
While Internet Explorer 6 supposedly has no support for max-width, IE7 at the very least recognizes it. So does IE8. Unfortunately, they only partially recognize it.
The bug so far as I can tell from my observations is that all containing elements for an image with a max-width set will act as if the image is full size even though IE appears to be respecting the max-width for the image itself.
so if i have a max-width of 100% set for all images and the image is naturally 500px in a div that is only 300 px, the image will be sized down to 300px...but the div its in will enlarge as if it was attempting to display the image at full size. i was able to hack around this using an older hack for emulating max width by using a css expression (supported by IE only) for the width.
my resulting img css definition looks like this
img { max-width:100%;width:expression(this.width > 500 ? 500: true);}
this isnt optimum as my container may be bigger than 500 or god forbid less in which but it does put a maximum value on the image that the containing elements respect. its more like a fail-safe value than anything, but it serves its purpose.
I got this hack from
http://phydeaux3.blogspot...and-faking-it-for-ie.html