absolutely position a relatively positioned element - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Relative Position

Description

absolutely position a relatively positioned element

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum dolor sit amet, c</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.parent-container {<!--from   www .  j  a va  2  s .  com-->
   position:relative;
   background:grey;
}

.child-container {
   position:absolute;
   background:red;
   left:21px;
}

.grandchild-container {
   position:absolute;
   background:yellow;
   left:21px;
}
</style> 
 </head> 
 <body> 
  <div class="parent-container">
    Lorem ip 
   <div class="child-container">
     Lorem ipsum 
    <div class="grandchild-container">
      Lorem ipsum 
    </div> 
    <br> 
    <br> 
    <br> 
   </div> 
   <br> 
   <br> 
   <br> 
   <br> 
  </div>  
 </body>
</html>

Related Tutorials