Position absolute inside a relative container - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Relative Position

Description

Position absolute inside a relative 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">
td {<!-- w w w  .  j a  va 2s  . c o m-->
   width:51px;
   height:51px;
   background:Chartreuse;
   border:6px solid yellow;
}
</style> 
 </head> 
 <body> 
  <table cellpadding="0" cellspacing="0"> 
   <tbody> 
    <tr> 
     <td> 
      <div style="position:relative"> 
       <div style="position:absolute">
         Lorem 
       </div> 
      </div> </td> 
     <td> 
      <div style="position:relative"> 
       <div style="position:absolute">
         Lorem 
       </div> 
      </div> </td> 
    </tr> 
    <tr> 
     <td> 
      <div style="position:relative"> 
       <div style="position:absolute">
         Lorem 
       </div> 
      </div> </td> 
     <td> 
      <div style="position:relative"> 
       <div style="position:absolute">
         Lorem 
       </div> 
      </div> </td> 
    </tr> 
    <tr> 
     <td> 
      <div style="position:relative"> 
       <div style="position:absolute">
         Lorem 
       </div> 
      </div> </td> 
     <td> 
      <div style="position:relative"> 
       <div style="position:absolute">
         Lorem 
       </div> 
      </div> </td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials