If you want to align a div vertically center and you don’t know its height use the below code:
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
Note that you need to specify a height to its parent element!
ref: http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/