Andres Ilich has it right. Just in case someone misses his comment…
A.) If you only have one line of text:
div
{
height: 200px;
line-height: 200px; /* <-- this is what you must define */
}
<div>vertically centered text</div>
B.) If you have multiple lines of text:
div
{
height: 200px;
line-height: 200px;
}
span
{
display: inline-block;
vertical-align: middle;
line-height: 18px; /* <-- adjust this */
}
<div><span>vertically centered text vertically centered text vertically centered text vertically centered text vertically centered text vertically centered text vertically centered text vertically centered text vertically centered text vertically centered text</span></div>