Z-index, 2 fixed divs, 1 of them in a position relative div - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Relative Position

Description

Z-index, 2 fixed divs, 1 of them in a position relative 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">
div {<!--  ww w.ja v  a2  s .  co  m-->
   width:81px;
   height:81px;
}
</style> 
 </head> 
 <body> 
  <div style="position: relative; z-index: 3;"> 
   <div style="background: blue; position: fixed; z-index: 3;"> 
   </div> 
  </div> 
  <div style="background: green; position: fixed; z-index: 2; top: 20px; left:10px;"> 
  </div>  
 </body>
</html>

Related Tutorials