菜单浮动顶部

<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

转载于:https://www.cnblogs.com/visense/p/3189356.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值