Positioning Div inside a container - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Positioning Div inside a container

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">
@charset"utf-8";<!--from   www .j a  v  a2s.c  om-->
#main {
   background-color:Chartreuse;
   width:1281px;
   height:100%;
   position:absolute;
}

#chapter1 {
   background:blue;
   width:91%;
   height:91%;
}

#chapter1_1 {
   background-color:yellow;
   width:100px;
   height:100px;
   left:100px;
   top:51px;
   position:absolute;
}

#chapter1_2 {
   background-color:blue;
   width:100px;
   height:100px;
   left:206px;
   top:51px;
   position:absolute;
}

#chapter1_3 {
   background-color:pink;
   width:100px;
   height:100px;
   top:156px;
   left:206px;
   position:absolute;
}
</style> 
 </head> 
 <body> 
  <div id="main"> 
   <div id="chapter1"> 
    <div id="chapter1_1"></div> 
    <div id="chapter1_2"></div> 
    <div id="chapter1_3"></div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials