email:
password:

Register
Forum Stats
Total Threads:
4104

Total Posts:
10050

Top Posters
Michael 2304
Dylan 1805
onemiamibum 710
JennyJM 645
nicole 484
Francisco 301
m1nr 262
Marty 256
dav 199
kyle 176
Fla 155
ultron 146
henryjoebob 142
Xandy 133
manic 127
Jess 124
Sarah 123
Cindy 123
Adam 106
Jessica 104
Random Faqqing
Why Should I Register For Idiotechnica.com?
The question is, why shouldn't you register. Click Here To Find Out.
firefox_logo
idiotechnica.com uses CSS3 and is optimized for viewing in Firefox versions 3+

Posts: Computers and Technology / CSS Max Width Image Probem IE7

share this thread on facebook

Michael Post Author Photo: Michael
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
Offline
Post ID: 1874