Center align vertically the container in bootstrap

This is the answer to "How to center align vertically the container in bootstrap" on Stackoverflow: http://stackoverflow.com/questions/22196587/how-to-center-align-vertically-the-container-in-bootstrap

by amitrdx

HTML

<link rel="stylesheet" href="http://getbootstrap.com/dist/css/bootstrap.css">
    <div class="jumbotron vertical-center">
      
      <div class="container text-center">
        <h1>The easiest and powerful way</h1>
        <div class="row">
          <div class="col-md-7">
            <div class="top-bg"></div>
          </div>

          <div class="col-md-5 iPhone-features">
            <ul class="top-features">
              <li>
                <span><i class="fa fa-random simple_bg top-features-bg"></i></span>
                <p><strong>Redirect</strong><br>Visitors where they converts more.</p>
              </li>
              <li>
                <span><i class="fa fa-cogs simple_bg top-features-bg"></i></span>
                <p><strong>Track</strong><br>Views, Clicks and Conversions.</p>
              </li>
              <li>
                <span><i class="fa fa-check simple_bg top-features-bg"></i></span>
                <p><strong>Check</strong><br>Constantly the status of your links.</p>
              </li>
              <li>
                <span><i class="fa fa-users simple_bg top-features-bg"></i></span>
                <p><strong>Collaborate</strong><br>With Customers, Partners and Co-Workers.</p>
              </li>
              <a href="pricing-and-signup.html" class="btn-primary btn h2 lightBlue get-Started-btn">GET STARTED</a>
              <h6 class="get-Started-sub-btn">FREE VERSION AVAILABLE!</h6>
            </ul>
          </div>
        </div>
      </div>
      
    </div>

CSS

html, body {
  height: 100%;
}

.jumbotron.vertical-center {
  margin-bottom: 0; /* Remove the default bottom margin of .jumbotron */
}

.vertical-center {
  min-height: 100%;  /* Fallback for vh unit */
  min-height: 100vh; /* You might also want to use
                        'height' property instead.
                        
                        Note that for percentage values of
                        'height' or 'min-height' properties,
                        the 'height' of the parent element
                        should be specified explicitly.
  
                        In this case the parent of '.vertical-center'
                        is the <body> element */

  /* Make it a flex container */
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex; 
  
  /* Align the bootstrap's container vertically */
    -webkit-box-align : center;
  -webkit-align-items : center;
       -moz-box-align : center;
       -ms-flex-align : center;
          align-items : center;
  
  /* In legacy web browsers such as Firefox 9
     we need to specify the width of the flex container */
  width: 100%;
  
  /* Also 'margin: 0 auto' doesn't have any effect on flex items in such web browsers
     hence the bootstrap's container won't be aligned to the center anymore.
  
     Therefore, we should use the following declarations to get it centered again */
         -webkit-box-pack : center;
            -moz-box-pack : center;
            -ms-flex-pack : center;
  -webkit-justify-content : center;
          justify-content : center;
}

.container {
  background-color: gold;
}