Side by side divs with negative relative position - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Relative Position

Description

Side by side divs with negative relative position

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 {<!--from w  ww .  j  av  a  2s.  c o  m-->
   width:251px;
   height:251px;
   position:absolute;
   top:51px;
   left:100px;
   border:2px solid Chartreuse;
}

#foo {
   position:absolute;
   top:6px;
   left:6px;
   height:51px;
   width:51px;
   border:2px solid yellow;
}

#bar {
   position:absolute;
   top:4px;
   left:4px;
   height:51px;
   width:51px;
   border:2px solid blue;
}
</style> 
 </head> 
 <body> 
  <div id="container"> 
   <div id="foo"></div> 
   <div id="bar"></div> 
  </div>  
 </body>
</html>

Related Tutorials