 <p>See <a href="http://www.jakpsatweb.cz/css/css-vertical-center-solution.html" rel="nofollow noreferrer">Vertical Centering in CSS</a>.</p> <blockquote> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Universal vertical center with CSS&lt;/title&gt; &lt;style&gt; .greenBorder {border: 1px solid green;} /* just borders to ser it */ &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="greenBorder" style="display: table; height: 400px; #position: relative; overflow: hidden;"&gt; &lt;div style=" #position: absolute; #top: 50%;display: table-cell; vertical-align: middle;"&gt; &lt;div class="greenBorder" style=" #position: relative; #top: -50%"&gt; any text&lt;br&gt; any height&lt;br&gt; any content, for example generated from DB&lt;br&gt; everything is vertically centered &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> </blockquote>