<style> * html,* html body{background-image:url(about:blank);background-attachment:fixed} </style> <div class="header_top header_top_fix" > <div class="header_nv"> <div class="header_bg"> <div class="header_center" > <div class="header_nav">武警昭通支队政治工作信息网欢迎你! </div> <div class="toplinks">23131</div> </div> </div> </div> </div> <style> .header_top_fix{ left:0px; top:0px; position:fixed; _position: absolute ; } .header_top{ z-index:9999; min-width:1000px; line-height:25px; /*border-bottom:1px solid #DBDBDB;*/ color:#676767; _position: absolute ; /*position:absolute; top:0px; left:0px;*/ width:100%; _top:expression(eval(document.documentElement.scrollTop)); } .header_nv{ height:35px; border-top:3px solid #C00; border-bottom:1px solid #e1e1e1;background:url("../images/green_skin.png") repeat-x scroll 0 -108px;} .header_bg{ height:35px;} .header_center{ width:960px; margin:0px auto; position:relative;} .header_nav{float:left; width:400px;} .toplinks{ float:right; text-align:right; } </style>
关键两点:(1)菜单居中,(2)ie6下fixed bug修正,参看《完美解决IE6不支持position:fixed的bug》
(1)对于菜单居中,外层设置width:100%,min-width:1000px; position:fixed;_position:absolute;
内层设置居中样式:margin:0 auto; text-align:center;position:ralative;
(2)ie fixed bug修正,利用css hack :添加_position:absolute; _top:expression(eval(document.documentElement.scrolltop));<ie6下距离top:0px>;添加* html,* html body{background-image:url(about:blank);background-attachment:fixed}修正滚动bug