zoukankan      html  css  js  c++  java
  • 关于IE6下fixed元素闪动的解决

          好久没更新博客了,最近在赶做公司一个产品主页的制作。制作过程中又有了一些小收获,在这里记录下来

          直接贴代码了,呵呵。也有注释的。其实就是添加了2行CSS,就可以让fixed元素在IE6下随滚动条而滚动却不闪动了。

         

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>底部广告条</title>
    <style type="text/css">
    *
    {margin:0; padding:0;}
    body
    {background-color:#FFFFFF;}
    .main
    {width:980px; background-color:#FF0; margin:0 auto;}
    .main p
    {height:500px; width:100%;}
    .fixed
    {height:41px; width:100%; background-color:#03F;position:fixed; text-align:center; color:#FFFFFF;
        left
    :0px;
        bottom
    :0px;
        z-index
    :999;/*为了让DIV永远在最前面,不被其他元素遮住*/
        _position
    :absolute;/*这里开始的2句代码是为ie6不兼容position:fixed;而写的*/
        _top
    :expression(eval(document.documentElement.scrollTop+documentElement.clientHeight-this.clientHeight));/*这里需要获取滚动高度+元素原本的高度*/
    }
    /*防止IE6下fixed元素闪动*/
    *html
    {
    background-image
    :url(about:blank);
    background-attachment
    :fixed;
    }
    </style>
    </head>

    <body>
    <div class="main">
    <p>aaaaaaaaaaaaaaaaaaaaaaaa</p><p>bbbbbbbbbbbbbbbbbbbbbbbbb</p><p>cccccccccccccccc</p>
    </div>
    <div class="fixed">我是滚动广告条</div>
    </body>
    </html>

  • 相关阅读:
    sqlserver获取当前id的前一条数据和后一条数据
    C#实现测量程序运行时间及cpu使用时间
    类库dll引用不成功问题
    合并相同字段
    Android之来历
    XML and JSON 验证
    特殊符号
    git 使用
    格式化字符串:金额
    grunt + sass 使用记录
  • 原文地址:https://www.cnblogs.com/Silvia/p/2455266.html
Copyright © 2011-2022 走看看