Positioning top bar fixed - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Fixed Position

Description

Positioning top bar 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">
* {<!--   w  ww .jav  a 2s  .co m-->
   margin:0;
   padding:0;
}

body {
   padding:0px;
}

div {
   border-radius:6px;
   border-collapse:collapse;
   margin:0px
}

#header {
   z-index:2;
   position:fixed;
   width:81%;
   height:61px;
   background-color:Chartreuse;
   margin:auto;
   left:11%;
}

#left {
   width:21%;
   height:1501px;
   background-color:yellow;
   z-index:3;
   position:relative;
   float:left;
   top:61px;
   left:11%;
}

#right {
   width:61%;
   z-index:0;
   height:1501px;
   background-color:blue;
   position:relative;
   float:right;
   right:11%;
   top:61px;
}

#footer {
   height:51px;
   background-color:pink;
   clear:both;
   width:81%;
   z-index:4;
   position:relative;
   left:11%;
}
</style> 
 </head> 
 <body> 
  <div id="header"></div> 
  <div id="left"></div> 
  <div id="right"></div> 
  <div id="footer"></div>  
 </body>
</html>

Related Tutorials