HTML CSS examples for CSS Layout:Fixed Position
keep fixed position div aligned with centered div
<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>