<h1>Vertical Center using Flexbox</h1>
<div class="vertical-centered-text">
  <h2>This should be centered</h2>
<p>Support: IE10+</p>
.vertical-centered-text {
  -ms-display: flex;
  display: flex;
  /* vertical center */
  align-items: center;
  /* horizontal center */
  justify-content: center;

/* just for the demo */
@import url(https://fonts.googleapis.com/css?family=Roboto:300);
html,body {height: 100%;}
body {
  font-family: 'Roboto', 'sans-serif';
  background-color: #e74c3c;
  color: white;
  text-align: center;
h1,h2,p {
  font-weight: 300;
  font-size: 2em;
  text-shadow: #c0392b 2px 2px 1px;
p {
  text-transform: uppercase;
  font-size: 1em;
div {
  margin: 5% auto;
  width: 80%;
  height: 200px;
  border: 2px solid #c0392b;
  border-radius: 6px;

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.