CSS: absolutely position div above parent div - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Absolute Position

Description

CSS: absolutely position div above parent div

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">
#container_head {
   width:100%;
   background-color:Chartreuse;
   z-index:11;<!--from  w w w  .  j  a  va 2 s .  c  o  m-->
}

#container_body {
   width:100%;
}

#container_foot {
   width:100%;
   background-color:yellow;
}

#main {
   width:961px;
   margin:0 auto;
   position:relative;
}

#menu {
   background-color:blue;
   width:171px;
   padding:11px;
   float:left;
   position:absolute;
   z-index:100;
}

#content {
   background-color:pink;
   width:751px;
   padding:11px;
   float:right;
}

.clear {
   clear:both;
}
</style> 
 </head> 
 <body> 
  <div id="container_head"> 
   <div id="menu">
     &nbsp; 
   </div> &nbsp; 
  </div> 
  <div id="container_body"> 
   <div id="main"> 
    <div id="content">
      &nbsp; 
    </div> 
   </div> 
   <div class="clear"></div> 
  </div> 
  <div id="container_foot">
    &nbsp; 
  </div>  
 </body>
</html>

Related Tutorials