michaelbarys of qwerty
11/3/2016 - 9:32 AM

Vertical align anything with just 3 lines of CSS http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/

Vertical align anything with just 3 lines of CSS http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/

.parent-element {
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  transform-style: preserve-3d;
}

.element {
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}