title: Reset image width and height set via css
body: <p>I'm trying to create a fluid-layout in html, containing images.
  For now, I support 2 sizes for the layout. The default layout is used to display a 1000px wide site. If the screen is wide enough (wider than 1200px), I enhance many aspects with css media queries.</p>
  
  <p>I have a DIV container that is 600px wide for the default layout, and 700px for the enhanced layout.
  There is a random image inside, for which I know some metadata (width and height). I may need to downsize the image if it is too large for the container.</p>
  
  <p>So I use this code to have a fluid-layout</p>
  
  <pre><code>&lt;div class="container"&gt;
    &lt;!-- for a 650px/400px image, the downsized version is 600px/369px --&gt;
    &lt;img src="/image?id=1234" width="650" height="400" style="width:600px;height:369px" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and the style</p>
  
  <pre><code>@media screen and (min-width:1200px){
    .container IMG {
      width:auto !important;
      height:auto !important;
    }
  }
  </code></pre>
  
  <ul>
  <li>Here is how it works:</li>
  </ul>
  
  <p>In case of the default layout, the inline style applies. So the image is down-sized to 600px/369px to fit the container.
  Otherwise, the media query style applies, and the image is at its default width/height (I know the image is never wider than 700px so all is fine).</p>
  
  <ul>
  <li>My problem comes from the loading state of the image and the space reserved by the browser. The behaviour of chrome/firefox is the same but is quite strange for me. Not tested with IE (not my priority actually)</li>
  </ul>
  
  <p>For the default layout, no problem, the inline-style still applies. The browser displays a white space corresponding to the image.</p>
  
  <p>For the enhanced layout, the "auto" sizes applies. But the browser does not know the natural size of the image while it is not fully loaded, and it appears that "auto" is equivalent to 0px. It would be perfect if the width and height attributes set for the image applied. But it is not the case. The result is that no space is reserved for the image, which is not the behaviour I want.</p>
  
  <ul>
  <li>A first solution I found is to add another inline css rule for the image. If I add "min-width:600px; min-height:369px" the reserved space for the image is always 600x369 pixels, instead of 0 pixels for the enhanced layout. That's better, but not perfect yet.</li>
  </ul>
  
  <p>-- What do you think ?</p>
  
  <ul>
  <li>Is it possible to "reset" the css instead of overriding it with the "auto !important" rule ?</li>
  <li>Should I use an other approach ?</li>
  <li>I may use some javascript, but I think it is a bad idea to rely on it. Actually, I may have a lot of containers similar to the one described above. I prefer an automatic solution (css is great for that).</li>
  </ul>