Create div with absolute position in css - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Absolute Position

Description

Create div with absolute position in 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">
div#container {<!--  w w w . j  av a2 s  .  c  o  m-->
   position:relative;
   border:2px solid Chartreuse;
   background-color:yellow;
}

#left {
   position:absolute;
   width:481px;
   height:481px;
   border:2px solid blue;
   background-color:pink;
}

#right {
   position:absolute;
   top:11px;
   right:11px;
   bottom:11px;
   width:251px;
   border:2px solid WhiteSmoke;
   background-color:OrangeRed;
   height:481px;
}
</style> 
 </head> 
 <body> 
  <div id="container"> 
   <div id="left"> 
    <h2>h2</h2> 
   </div> 
   <div id="right"> 
    <h2>h2</h2> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials