Use this code to vertically align text in a div:
div { border:1px solid green;}
<div style="display: table; height: 400px; overflow: hidden;">
<div style="display: table-cell; vertical-align: middle;">
<div>
everything is vertically centered in modern IE8+ and others.
</div>
</div>
</div>
It's possible to merge hacks for old browser (IE6/7) into styles with using # to hide styles from newer browsers like this:
div { border:1px solid green;}
<div style="display: table; height: 400px; #position: relative; overflow: hidden;">
<div style=
"#position: absolute; #top: 50%;display: table-cell; vertical-align: middle;">
<div style=" #position: relative; #top: -50%">
everything is vertically centered
</div>
</div>
</div>
For Vertical Centering in CSS refer to this link http://www.jakpsatweb.cz/css/css-vertical-center-solution.html
For CSS2 browser one you can use display:table/display:table-cell to center content.