title: Bootstrap 4 modal scale with content
body: <p>I'm using bootstrap 4 modal, the modal basically just contain an image. Right now I set my modal dialog max-width to 95%. Whenever the modal opens, it's always 95%, which looks good when the image is large. But when there's a tiny image, the modal is still 95% width and there's the tiny image, which doesn't look really good. </p>
  
  <p>How do I scale the modal so that if the image is big, the width will be 95% but if the image is small, it will adjust to the max-width of that image?</p>
  
  <p>the css file, most of this code is just to make the modal appear in the center of the screen</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>.modal-dialog {
    min-height: -webkit-calc(100vh - 60px);
    min-height: -moz-calc(100vh - 60px);
    min-height: calc(100vh - 60px);
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -moz-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    overflow: auto;
    max-width: 95%;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/&gt;
  &lt;div class="modal"&gt;
    &lt;div class="modal-dialog"&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-body"&gt;
          &lt;img [src]="picture" alt="large picture" class="img-fluid"&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>