The easiest way to center text vertically using CSS is to set the line-height to the same size as the container's height.
Example
//Add this to your STYLE tag or external CSS file
div#header {
height: 100px;
line-height: 100px;
}
<div id="header">
My text
</div>
UPDATE: Also see
Tuesday, April 28, 2009
Subscribe to:
Post Comments (Atom)
This only works with one line of text. As soon as your text wraps to a second you've got a giant gap between your two lines.
ReplyDelete