Skip to main content

Easiest way to vertical align text - link within a box

So you want to center align a div within a div but it does not work as expected? for example this solution http://codepen.io/Tipue/pen/vsKif did not work out for my divs. a{ text-align: center; display: table; height: 100%; width: 100%; background: rgba(0,0,0,0.4); } a span{ display: table-cell; vertical-align: middle; } No problemos! we call the "old" table solution to the rescue. Setting display of parent as a table and then the child as table-cell did the trick. Enjoy!
center align