Position absolute inside position fixed - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Fixed Position

Description

Position absolute inside position fixed

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">
#main {<!-- w w w .  j  a v  a 2s.  c  om-->
   background:Chartreuse;
   width:301px;
   height:301px
}

#inner {
   background:yellow;
   text-align:center;
   margin:21px;
   padding:21px
}
</style> 
 </head> 
 <body> 
  <div id="main" style="position: fixed"> 
   <div id="inner" style="position: absolute">
     Lorem ipsum 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials