CSS Centering Using line-height


You can also use line-height to center vertically a single line of text inside a container :


div {
    height: 200px;
    line-height: 200px;

That's quite ugly, but can be useful inside an <input /> element. The line-height property works only when the text to be centered spans a single line. If the text wraps into multiple lines, the resulting output won't be centered.