title: Vertically center the showing images on a fixed height Bootstrap carousel
body: <p>Maybe this is one of the toughest challenges, how can I vertically align in the middle the showing images on this fixed height Bootstrap <em>(v3.3.5)</em> carousel? I'd tried to <code>display</code> some classes as a <code>table-cell</code> and <code>vertical-align</code> them to <code>middle</code> but there's still a problem, the sliding image will just be vertically aligned when sliding-completed or when <code>.active</code> but it will also placed the image on the right side instead to the center.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>/* The styles that I tried.
  .carousel-inner &gt; .item.next.left,
  .carousel-inner &gt; .item.prev.right,
  .carousel-inner &gt; .item.active {
      display: table-cell;
      vertical-align: middle;
  } */
  
  .carousel-inner &gt; .item {
      height: 150px;
  }
  
  .carousel-inner img {
      margin: auto;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;head&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="carousel-example-generic" class="carousel slide" data-ride="carousel"&gt;
          &lt;!-- Indicators --&gt;
          &lt;ol class="carousel-indicators"&gt;
              &lt;li data-target="#carousel-example-generic" data-slide-to="0" class="active"&gt;&lt;/li&gt;
              &lt;li data-target="#carousel-example-generic" data-slide-to="1"&gt;&lt;/li&gt;
              &lt;li data-target="#carousel-example-generic" data-slide-to="2"&gt;&lt;/li&gt;
          &lt;/ol&gt;
  
          &lt;!-- Wrapper for slides --&gt;
          &lt;div class="carousel-inner" role="listbox"&gt;
              &lt;div class="item active"&gt;
                  &lt;img src="http://placehold.it/350x65" alt="350x65"&gt;
                  &lt;div class="carousel-caption"&gt;
                      &lt;h3&gt;Item 1&lt;/h3&gt;
                      &lt;p&gt;Not vertically center..&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="item"&gt;
                  &lt;img src="http://placehold.it/350x150" alt="350x150"&gt;
                  &lt;div class="carousel-caption"&gt;
                      &lt;h3&gt;Item 2&lt;/h3&gt;
                      &lt;p&gt;The image height is just fit..&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="item"&gt;
                  &lt;img src="http://placehold.it/200x100" alt="200x100"&gt;
                  &lt;div class="carousel-caption"&gt;
                      &lt;h3&gt;Item 3&lt;/h3&gt;
                      &lt;p&gt;Not vertically center..&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;!-- Controls --&gt;
          &lt;a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"&gt;
              &lt;span class="glyphicon glyphicon-chevron-left" aria-hidden="true"&gt;&lt;/span&gt;
              &lt;span class="sr-only"&gt;Previous&lt;/span&gt;
          &lt;/a&gt;
          &lt;a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"&gt;
              &lt;span class="glyphicon glyphicon-chevron-right" aria-hidden="true"&gt;&lt;/span&gt;
              &lt;span class="sr-only"&gt;Next&lt;/span&gt;
          &lt;/a&gt;
      &lt;/div&gt;
  
  
      &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>