Position div using pure css - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Position div using pure css

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">
#outer {<!--  w w w .  j a  v a2 s . co m-->
   position:relative;
   width:401px;
   height:401px;
   margin-left:100px;
   top:100px;
   padding-top:76px;
}

#inner {
   overflow:hidden;
   border:2px solid Chartreuse;
   height:100%;
}

#above {
   position:absolute;
   top:0;
}
</style> 
 </head> 
 <body> 
  <div id="outer"> 
   <div id="inner"> 
    <div id="above"> 
     <div>
       Lorem 
     </div> 
     <div>
       Lorem 
     </div> 
     <div>
       Lorem i 
     </div> 
     <div>
       Lorem 
     </div> 
    </div> 
    <div>
      Lorem ip 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials