If you don't mind adding an extra HTML class, your easiest way is to simply use vertical alignment: medium.
http://jsfiddle.net/Wexcode/HtNJM/
<div class="post"> <span></span><h2><a href="#">Hello!</a></h2> </div>
CSS
* { margin: 0; padding: 0; } .post { background: rgba(0,0,0,0.8); width: 200px; height: 200px; } .post span { height: 100%; vertical-align: middle; display: inline-block; } .post h2 { position: relative; text-align: center; width: 100%; vertical-align: middle; display: inline-block; } .post h2 a { color: #f7f7f7; font-size: 2.2em; font-weight: normal; font-style: italic; display: block; }
source share