position divs on top of one another - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

position divs on top of one another

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">
#page-left {
   float:left;
   margin:6px;
}

#page-right {
   float:left;
   margin:6px;
}

#largest {<!--   w ww.j av  a  2s.com-->
   position:absolute;
   z-index:2;
}

#medium {
   position:absolute;
   z-index:3;
}

#smallest {
   position:absolute;
   z-index:4;
}
</style> 
 </head> 
 <body> 
  <div id="book-wrapper"> 
   <div id="page1"> 
    <div id="largest"> 
     <img src="https://www.java2s.com/style/demo/Firefox.png"> 
    </div> 
    <div id="medium"> 
     <img src="https://www.java2s.com/style/demo/Opera.png"> 
    </div> 
    <div id="smallest"> 
     <img src="https://www.java2s.com/style/demo/Safari.png"> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials