HTML CSS examples for CSS Layout:Text
Simple text centered in page vertically and horizontally
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> html, body { margin:0; padding:0; width:100%; height:100%; } .wrapper {<!--from ww w .j a v a 2 s . com--> background:Chartreuse; height:100%; width:100%; margin:0; padding:0; display:table; } img { width:100%; height:100%; } .outer-wrapper { position:absolute; width:100%; height:100%; top:0; margin:0; padding:0; } .table-wrapper { display:table; vertical-align:middle; text-align:center; width:100%; height:100%; } .table-cell-wrapper { display:table-cell; vertical-align:middle; text-align:center; width:100%; height:100%; } </style> </head> <body> <div class="wrapper"> <img src="https://www.java2s.com/style/demo/Safari.png"> <div class="outer-wrapper"> <div class="table-wrapper"> <div class="table-cell-wrapper"> <h1>Lorem ip</h1> <h5>Lorem ip</h5> </div> </div> </div> </div> </body> </html>