代码之家  ›  专栏  ›  技术社区  ›  olemarius

固定底部对齐Div

css
  •  1
  • olemarius  · 技术社区  · 15 年前

    我需要一个页脚在页面底部,这是重叠的任何内容,将使页面滚动。而且,当向下滚动时,页脚仍然需要留在那里。

    在css只适用于IE6+的情况下,这可能吗?

    4 回复  |  直到 15 年前
        1
  •  6
  •   a programmer    15 年前

    最近我使用了以下样式:

    div.BottomDisclaimer
    {
      z-index:100;
      position:fixed;
      bottom:0px;
      border-top-style: solid;
      border-top-width: 1pt;
      padding-top: 4px;
    }
    
        2
  •  1
  •   peirix    15 年前

    在谷歌上快速搜索CSS footer,你会找到很多解决方案。但大多数解决方案似乎都是这样工作的:

    <body>
      <div id="wrapper">
         Main content
      </div>
      <div id="footer">
         Footer content
      </div>
    </body>
    

    然后应用css:

    body, html { height: 100% }
    #wrapper { height: 100% }
    #footer {
      height: 150px;
      margin-top: -150px;
    }
    
        3
  •  0
  •   Paul Fisher    15 年前

    对于IE6,不可能使用 position:fixed . 你可以用迪恩·爱德华兹 IE7 library 如果你愿意的话。

        4
  •  0
  •   Moayad Mardini    15 年前

    IE6不支持编辑,因为位置:固定;,这是 a good workaround