HTML CSS examples for CSS Layout:Position
Position an overlay in the center of the page
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .mydiv {<!-- ww w . jav a2 s .c om--> width:301px; height:301px; background:red; position:fixed; top:51%; left:51%; margin-top:-151px; margin-left:-151px; } </style> </head> <body> <div class="mydiv"></div> </body> </html>