【问题标题】:div in bottom of window, not pagediv 在窗口底部,而不是页面
【发布时间】:2010-03-03 13:28:12
【问题描述】:

我想要一个 div 元素,在窗口的底部。就像旧 facebook.com 底部页面中的 div。或喜欢初始 facebook.com 的聊天 div

【问题讨论】:

    标签: javascript jquery html css


    【解决方案1】:

    您可以使用position: fixed; bottom: 0px。但在 IE6 中不起作用。

    <style type="text/css">
        #footer { position: fixed; bottom: 0px; }
    </style>
    
    <div id="footer">I am at the bottom of the window</div>
    

    【讨论】:

    • IE6 支持的解决方法也很少。尝试搜索 ie-fixed.htc - .htc 文件将强制 IE 理解该位置。
    【解决方案2】:

    尝试使用它。这里的底栏是用 div 元素制作的。我想你可以使用任何你想要的元素,只需引用 CSS 类。我只测试了 div 元素

    /* HTML */
    <div class='always-at-bottom'>Always at bottom!</div>
    
    /* CSS */
    .always-at-bottom {
        height:40px;
        position: fixed;
        left: 0;
        bottom: 0%;
        width: 100%;
        background-color: blue;
    }
    

    【讨论】:

      猜你喜欢
      • 2015-02-04
      • 1970-01-01
      • 2021-01-19
      • 2013-12-15
      • 2018-08-18
      • 1970-01-01
      • 1970-01-01
      • 2015-08-30
      • 1970-01-01
      相关资源
      最近更新 更多