Position by center point - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Position by center point

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum do</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
#parent {<!--from  w ww  . j a  v a2 s.  c o m-->
   width:501px;
   height:501px;
   background:Chartreuse;
   position:relative;
   display:flex;
   align-items:center;
   justify-content:center;
   flex-wrap:wrap;
}

#child {
   background:yellow;
   height:100px;
   width:100px;
   margin:6px;
   position:relative;
}
</style> 
 </head> 
 <body> 
  <div id="parent"> 
   <div id="child"></div> 
   <div id="child"></div> 
   <!--   <div id="child"></div> --> 
   <!--   <div id="child"></div> --> 
   <!--   <div id="child"></div> --> 
   <!--   <div id="child"></div> --> 
   <!--   <div id="child"></div> --> 
  </div>  
 </body>
</html>

Related Tutorials