Fixed and overlaid position in CSS - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Fixed Position

Description

Fixed and overlaid 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">
#container {<!--  w  w w  . j a v a  2 s.  c o  m-->
   position:relative;
   padding-top:41px;
}

#top {
   position:fixed;
   top:0px;
   left:0px;
   height:41px;
   width:100%;
   background:black;
}

#content {
   height:601px;
   background:gray;
}
</style> 
 </head> 
 <body> 
  <div id="container"> 
   <div id="top"> 
   </div> 
   <div id="content">
     Lorem ipsum 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials