title: Automatically resize an image to fit in a container
body: <p>How do I automatically resize an image to fit it into a container? I would like to have a blank background for the container. Currently it is like this:</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;div class="col-md-3"&gt;
          &lt;div class="panel panel-primary"&gt;
              &lt;div class="panel-heading"&gt;
                  &lt;div class="row"&gt;
                      &lt;img src ="haha.png"/&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I would like to have a container where I could fit the image inside, automatically resizing the image.</p>
  
  <p><a href="https://i.stack.imgur.com/qUiCt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qUiCt.png" alt="enter image description here"></a></p>