div块始终在顶部且不被覆盖,就像新版微博顶部的导航条一样?急呀!

解决方案 »

  1.   

    <body style="z-index:0;background:#ff0;width:100%;height:1000px;">
    <div style="position:fixed;width:100%;height:200px;display:block;background:#f00;z-index:1000;top:0;left:0">
    顶部
    </div>
    <div style="float:left;width:100%;height:200px;display:block;background:#15c;padding-top:800px;">
    底部
    </div>
    </body>
      

  2.   

     
    <!doctype html>
    <html dir="ltr" lang="zh-CN">
      <head>
        <meta charset="utf-8"/>
        <title>CSS Position Fixed for IE6</title>
        <style>
    * html,* html body   {background-image:url(about:blank);background-attachment:fixed;}
    * html .fixed-top    {position:absolute;bottom:auto; top:expression(eval(document.documentElement.scrollTop +(document.documentElement.clientHeight-this.offsetHeight)/2 ));}
    * html .fixed-right  {position:absolute;right:0px;left:auto;}
    * html .fixed-bottom {position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}
    * html .fixed-left   {position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft));}
    .fixed-bottom  {
      position:fixed;
      left:0px;
      bottom:20px;
      background:aqua;
      width:200px;
      height:200px;
    }
    .fixed-right{
      position:fixed;
      right:0px;
      left:auto;
      top:200px;
      top:expression(eval(document.documentElement.scrollTop +(document.documentElement.clientHeight-this.offsetHeight)/2 ));
      background:red;
      width:200px;
      height:200px;
    }
    .fixed-top{
      position:fixed;
      top:0px;
      left:0px;
      background:blue;
      width:200px;
      height:200px;
    }
        </style>  </head>
      <body>
      <div style='height:2000px;width:500px;margin:10px auto; border:1px solid red;'></div>
       <div class="fixed-top"></div>
        <div class="fixed-bottom"></div>
         <div class="fixed-right"></div>
        
      
      </body>
    </html>
      

  3.   

    对,给你的元素或者div 加上z-index。。想放在最上面的z-index:5;值大一点希望被覆盖的z-index:4;小一点即可
      

  4.   

    最主要的是position和z-index吧,我把#top这个div设置成:position:absolute;z-index:1;top:0px;
    还是没有效果啊。
      

  5.   


    .myAlbumMain_pop_control_btnCancel_boreder
    {
        opacity:1.5;/*FF*/   //半透明样式
        z-index:1000000;     //最顶端
        position:fixed!important;  //跟随滚动条走,怎么晃都不动,下面都是,真对IE各种版本
        position:absolute;/*IE6*/  
        _top:expression(eval(document.compatMode &&
        document.compatMode=='CSS1Compat') ?
        documentElement.scrollTop + (document.documentElement.clientHeight-this.offsetHeight)/2 :/*IE6*/
        document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2);/*IE5 IE5.5*/
    }
      

  6.   

    这个positio:fixed!important;
    有用,谢谢了!谢谢大家!