title: CSS - how to make image container width fixed and height auto stretched
body: <p>I've go some html code like this: </p>
  
  <pre><code> &lt;div class="item"&gt;
      &lt;img src="..."&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>And css code like this:</p>
  
  <pre><code>img {
      max-width: 100%;
      height: auto;
  }
  
  .item {
      width: 120px;
      height: 120px;
      height: auto;
      float: left;
      margin: 3px;
      padding: 3px;
  }
  </code></pre>
  
  <p>What I would like to do is to make the img display using the div's width and stretch its height. I also want the div stretch itself to fit the img. Is that possible?</p>