keep fixed position div aligned with centered div - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Fixed Position

Description

keep fixed position div aligned with centered 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">
#nav {<!--from  w  w w.j  a  va  2s . co m-->
   width:201px;
   height:51px;
   margin:0 26px;
   position:fixed;
   top:0;
   background:red;
}

#wrapper {
   width:251px;
   height:1001px;
   margin:0 auto;
   background:blue;
}

#content {
   width:201px;
   height:1001px;
   margin:0 auto;
   background:green;
}
</style> 
 </head> 
 <body> 
  <div id="wrapper"> 
   <div id="nav"></div> 
   <div id="content"> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials