HTML CSS examples for CSS Layout:Box
Center a box in the vertical and horizontal middle of the screen and place other boxed underneath
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .wrapper {<!--from ww w .ja v a 2s . com--> position:fixed; top:51%; left:51%; transform:translate(-51%, -51%); } #centeredBox { position:relative; border:2px solid Chartreuse; } #underCenteredBox { display:block; background-color:yellow; position:relative; } #underUnderCenteredBox { display:block; background-color:blue; position:relative; } </style> </head> <body> <div class="wrapper"> <div id="centeredBox"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper mol </div> <div id="underCenteredBox"> Lorem ipsum dolor </div> <div id="underUnderCenteredBox"> Lorem ipsum dolor sit a </div> </div> </body> </html>