title: Vertically align center in a bootstrap modal when the image is small
body: <p>I am using a bootstrap modal to show images of different sizes. And I would like that the modal body has minimal width and height (600*400 actually). So when an image is bigger it expands and works well, but when the image has a height inferior to 400px, the image is aligned (vertically) at the top. So I would like to align it vertically in the middle of the modal body. </p>
  
  <p>I have tried: </p>
  
  <pre><code>.vcenter {
       display: inline-block;
       vertical-align: middle;
       float: none;
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>.image-center {
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
      margin: auto;
  }
  </code></pre>
  
  <p>on the object tag but doesn't work well. </p>
  
  <p>Here is my css (the object represent the image):</p>
  
  <pre><code> object  {
      width:auto;
      max-width: 100%;
      max-height: 70vh;
      width: auto\9; /* ie8 */
    }
  
    .modal-header {
      text-align: left;
    }
  
    @media (min-width: 768px){
      .modal-dialog {
        max-width: 95%;
      }
      .modal-body{
        min-width: 600px;
        min-height: 400px;
      }
    }
  
    .modal-dialog {
        width: auto;      
        text-align: center;
      }
  
    .modal-content{
      display:inline-block;
      text-align: center;
    }
  </code></pre>
  
  <p>and my html for one modal:</p>
  
  <pre><code>&lt;div class="modal fade" id="myModal" role="dialog"&gt;
    &lt;div class="modal-dialog"&gt;
      &lt;!-- Modal content--&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal"&gt;×&lt;/button&gt;
          &lt;h4 class="modal-title"&gt;Modal Header&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          &lt;object data="https://og.github.com/mark/github-mark@1200x630.png" type="image/png"&gt;
          &lt;/object&gt;
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is also a <a href="http://plnkr.co/edit/jIKJ9beA77x4R0wyD7KS?p=preview" rel="nofollow">plunker</a> showing the comparison between the behavior with the small image and a bigger one.</p>
  
  <p>Any idea?</p>
  
  <p>Thanks</p>