title: Fit image inside nested div
body: <p>How can I fit this image inside the <code>div</code> with <code>inner</code> class using <code>CSS</code>? I can't change the <code>HTML</code>.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>* {
    box-sizing: border-box;
  }
  
  .outer {
    width: 300px;
    height: 200px;
    overflow: hidden;
    padding: 5px;
  }
  
  .inner {
    width: 100%;
    height: 100%;
    border: solid 2px black;
  }
  
  img {
    max-width: auto;
    height: 100%;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="outer"&gt;
    &lt;div class="inner"&gt;
      &lt;p&gt;
        &lt;img src="https://i.stack.imgur.com/oI2SB.jpg?s=328&amp;g=1"&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>