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

粘脚的行为怪异

  •  0
  • Teilmann  · 技术社区  · 13 年前

    我已经为我的网站做了一个粘性的页脚,但它并不像我想的那样。 我希望它完全在底部,总是取决于内容的长度。相反,它总是出现在屏幕上。有人能帮我吗?

    This site

    页脚css:

    #footer{
    position: fixed;
    bottom: 0;
    z-index: 1;
    width: 100%;
    height: 50px;
    clear: both;
    background-image: url("../images/footer_pattern.png");
    

    }

    2 回复  |  直到 13 年前
        1
  •  1
  •   Tom    13 年前
    #footer{
    width: 100%;
    height: 50px;
    clear: both;
    background-image: url("../images/footer_pattern.png");
    display: block;
    margin-top: 0px;
    //if contains children add overflow:hidden;
    }
    
        2
  •  0
  •   OneChillDude    13 年前

    你的问题有点模糊,但如果我理解正确的话,我认为你想要的是职位:相对的。

    position: relative;
    bottom: 10px;
    

    这样做的目的是在元素和下一个相对父元素之间添加指定量的空间(10px)。祝你好运