Add fixed positioned header to page - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Fixed Position

Description

Add fixed positioned header to page

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">
#header {<!-- w ww . java2 s . co  m-->
   left:0px;
   top:0px;
   width:100%;
   height:31px;
   background-color:Chartreuse;
   z-index:2;
   overflow:hidden;
   min-width:281px;
   position:fixed;
}
</style> 
 </head> 
 <body>
   blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> 
  <div id="header"></div> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br> blah 
  <br>  
 </body>
</html>

Related Tutorials