Vertically aligning text using CSS

To vertically align text-based elements, use the line-height property, which specifies the amount of vertical space between lines of text. Simply match the line-height with the height of the element.

h1 {
font-size: 12px
height: 100px;
line-height: 100px;
}