title: How to fit image height to the parent div's height
body: <p>I want that the image height fits to the parent div's height, but the image is overflowing. How can I resolve this?</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>.image-parent{
      max-height: 50%;
  }
  img{
      height: 100%;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="image-parent"&gt;
       &lt;img src="example.jpg" alt=""&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>