HTML CSS examples for CSS Layout:Div Align
After aligning a div horizontally and vertically center
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .outer {<!-- ww w . ja v a 2 s.com--> display:table; position:absolute; height:100%; width:100%; } .middle { display:table-cell; vertical-align:middle; } .inner { margin-left:auto; margin-right:auto; background:blue; height:51%; width:51%; display:flex; flex-direction:column; justify-content:center; } </style> </head> <body> <div class="outer"> <div class="middle"> <div class="inner"> <div align="center"> <h1>The Content</h1> <p>Once upon a midnight dreary...</p> </div> </div> </div> </div> </body> </html>