StevieD
StevieD

Reputation: 7443

Image not resizing in ie8 when browser width changes

I'm following the tip here fore resizing images in ie8: http://blog.kurtschindler.net/post/flexible-dynamically-resizing-images-with-css

I'm having no luck getting this to work on my site, though. I wrote some simple code here to strip away any complexity and I'm still not getting anywhere. I have to be missing something simple.

<html>
  <head>
  <style>
     .container img {
     max-width: 100%;
     height: auto;
     width: auto; /*for ie8*/
     }
     .container { 
     width: 100%;
     }
  </style>
  </head>
  <body>
    <div class="container">
     <img src="image.jpg" />
    </div>
  </body>
</html>

Upvotes: 0

Views: 2348

Answers (1)

Dan
Dan

Reputation: 184

This is the only CSS you should need:

.container img {
    width: 100%;
 }
.container { 
    width: 100%;
}

The image will scale with the browser.

Upvotes: 2

Related Questions