schneikai
2/21/2014 - 2:08 PM

Vertical and horizontal centering without magic!

Vertical and horizontal centering without magic!

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  display: table;
}
.container {
  display: table-cell;
  text-align: center;
  vertical-align: middle;
}
.content {
  background-color: red; /* just for the demo */
  display: inline-block;
  text-align: left;
} 
<div class="container">
  <div class="content">
    content content content 
    <br/>
    moooooooooooooooore content
    <br/>
    another content
  </div>
</div>