CSS: Position text in the middle of the page

You can use position: absolute and topmargin-top to vertically align something whose height you know, and line-height to give a single line of text a known height with the text in the middle:

h1 {
    left: 0;
    line-height: 200px;
    margin-top: -100px;
    position: absolute;
    text-align: center;
    top: 50%;
    width: 100%;
}
<h1>Hello, world!</h1>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)