Center A box in the middle of the page - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Parent Container

Description

Center A box in the middle of the page

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
#box {<!--from   w  w  w  . ja  va  2  s .c o  m-->
   position:fixed;
   width:301px;
   height:301px;
   top:51%;
   left:51%;
   margin-top:-151px;
   margin-left:-151px;
   border:2px solid Chartreuse;
}
</style> 
 </head> 
 <body> 
  <div id="box">
    box 
  </div>  
 </body>
</html>

Related Tutorials