views:

1444

answers:

5

I have an image with this markup

<img src="wedding_00.jpg" width="900" height="600" />

And I am using CSS to downsize it to 600px width, like so:

img {
    max-width:600px;
    height:auto;
}

Can anyone explain why this method works in Compatibility mode, but not in standard mode? Is there a way I can modify my CSS so that it will work in standard mode?

I realize that if I strip out the

width="900" height="600"

that it solves the problem, but that is not an option I have.

Test page to try it out:

http://netrivetsandbox.com/ie8/ie8.html

+1  A: 

I'm not sure of the root cause but if you add

width: auto;

then it works.

Greg
brilliant, works perfectly. I don't think I would have tried that in a million years.
Jared Henderson
A: 

great fix... I've been searching for this all over. why oh why is IE so difficult!

christopher
A: 

Thanks for that solution - saved me some time!

Michael Sibley
A: 

my solution was :

a.link img{ max-height:500px ; width:auto !important; max-width:400px; height:auto !important; width:1px; }
Andrei
A: 

I had the same problem - fortunately i did'n actually need the "max" - so i just replaced "max-width" with "width" but I am getting really annoyed with IE - every thing I do is valid HTML, but there always are some problems in IE that needs to be fixed. But what really needs fixing is Internet Explorer!

vassbg