【问题标题】:Is this a clearfix float? I can't get my footer to be at the bottom of the page这是一个clearfix浮动吗?我无法让页脚位于页面底部
【发布时间】:2015-02-19 09:43:08
【问题描述】:

我希望我的页脚位于每页内容之后的页面底部(不固定) 我阅读了有关创建粘性页脚的帖子,并尝试了:

position: absolute;
bottom: 0;

但我的页脚仍然在浮动的图像之后。我放了一个clearfix,但这并没有解决它。我做错了什么,这是链接:

【问题讨论】:

    标签: html css


    【解决方案1】:

    我猜你的问题是“主要内容”的高度。

    删除它,然后设置:

    html {
      position: relative;
      min-height: 100%;
    }
    

    “主要内容”上的“padding-bottom”与页脚高度相同(或更高),用于间距。

    一个完整的例子可以在CSS-tricks找到

    【讨论】:

      【解决方案2】:

      设置

       position: absolute;
       bottom: 0;
      

      将它放到窗口底部,但如果您的页面较长,您会得到与您的页面类似的结果..

      您可以将其设置为固定,包装其他内容并在下方为您的页脚留出 75 像素的空间,check this ;

      【讨论】:

        【解决方案3】:

        用途:

        position:fixed;
        bottom:0px;
        

        【讨论】:

          猜你喜欢
          • 2014-08-13
          • 1970-01-01
          • 2012-01-26
          • 2011-11-24
          • 1970-01-01
          • 2018-06-05
          • 1970-01-01
          相关资源
          最近更新 更多