title: Why doesn't object-fit affect width or height?
body: <p>I have a 240*240px image inside a 100*300px div (demo values, actual values vary and are unknown). I use <code>object-fit: contain</code> to make the image completely visible inside the div and also keep it's aspect ratio. The problem is that <code>object-fit</code> isn't modifying the width of the image, resulting in a weird "padding" (so to say). </p>
  
  <p><a href="https://i.stack.imgur.com/D0wym.png" rel="noreferrer"><img src="https://i.stack.imgur.com/D0wym.png" alt="enter image description here"></a></p>
  
  <p>How can I make the image take only as much width as required, instead of taking the original width?</p>
  
  <p>Demo: <a href="http://codepen.io/alexandernst/pen/ONvqzN" rel="noreferrer">http://codepen.io/alexandernst/pen/ONvqzN</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.wrapper {
    height: 100px;
    width: 300px;
    border: 1px solid black;
  }
  .flex {
    display: flex;
  }
  img {
    object-fit: contain;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="flex wrapper"&gt;
    &lt;img src="https://unsplash.it/240/240" /&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>