【问题标题】:making a footer stick to the bottom of the page使页脚粘在页面底部
【发布时间】:2011-06-30 17:32:29
【问题描述】:

我在我正在制作的网站上遇到了一些代码,应该很简单,但事实证明并非如此。

我希望我的页脚贴在页面底部,但所有内容都排在第一位(当页面价值超过一页时,如果有意义的话)

我已经能够在 Safari、Chrom 和 Firefox 中做到这一点,但令人惊讶的是 Internet Explorer 被证明是主要问题。

现在它位于底部,但页脚出现在页面内容上方时(请参阅“我们是谁”标签)。

http://www.break-comms.com/index.html

我真的很感激任何帮助,因为它真的开始让我烦恼,现在已经回去更改代码好几个小时了。

下面是页面附带的 CSS,就像我说的那样,任何帮助都将非常感激。

* {
    border:0px;
    margin:0px;
    padding:0px;
}

#html {
    height:100%;
    }


#banner {
    padding: 5px 0px 10px 0px;
}

#container {
    width:970px;
    margin:0 auto;
    height: 100%;
    position: relative;
}

#wrapper {
    position: relative;
    min-height: 100%;

}
#nav {
    margin-left:0px;
    text-indent:0px;
    text-align:center;
}

#menutab li {
    display:inline;
    list-style-type:none;
    font-family:Arial;
    font-size:18px;
    font-weight:100;
    text-align:center;


}

#menutab a {
    color:#9ea3ab;
    padding:5px 32px 5px 32px;
    text-decoration:none;
    text-align:center;
}

#menutab b {
    color:#9ea3ab;
    padding:5px 0px 5px 0px;
    text-decoration:none;
    text-align:center;
}


#menutab a:hover {
    color:#28957f;
}

#social .socialImage{float:right;

}

.divFloat {
float:right;
padding:0px 5px 0pc 0px;
}

.clear {
clear:both;
}

#social {
    background:transparent;
}

#footer {
    Position:fixed;
    bottom:0;
    width:970px;
    height:45px;
    background-image:url(images/footer.gif); width:970px; height:45px;
}



#footermenu .footermenu{float:right;

}

#footermenu li {
    display:inline;
    font-family:Arial;
    list-style-type:none;
    font-size:16pt;
}

#footermenu a {
    color:#9ea3ab;
    font-family:Arial;
    padding:0px 5px 0px 0px;
    text-decoration:none;
    text-align:right;

}

#footermenu a:hover {
    color:#28957f;
}

.clearfooter {
    height:45px;
    clear:both;
    }
#address {
    color:#28957f;
    font-family:Arial;
    font-size:16px;
    text-indent:5px;
}

#address2 {
    color:#9ea3ab;
    font-family:Arial;
    font-size:14px;
    text-indent:5px;
}

#contentbackground {
    background-image:url("images/homebackgroundimage.gif"); width:970px; height:400px;
}

#contentbackgroundcontact {
    background-image:url("images/contactbackgroundimage.gif"); width:970px; height:330px;
}

#contentbackgroundyouth {
    background-image:url("images/youthbackgroundimage.gif"); width:970px; height:350px;
}

#contectbackgroundwhoweare {
    background-image:url("images/whowearebackgroundimage.gif"); width:970px; height:700px;
}

#contentbackgroundmusic {
    background-image:url("images/musicbackgroundimage.gif"); width:970px; height:360px;
}

#contentbackgroundbrand {
    background-image:url("images/brandbackgroundimage.gif"); width:970px; height:500px;
}

#content {
    color:#9ea3ab;
    font-family:Arial;
    font-size:14px;
    padding:5px 30px 5px 50px;
    text-decoration:none;
    text-align:top;
}

#content2 {
    color:#9ea3ab;
    font-family:Arial;
    font-size:14px;
    padding:5px 30px 5px 70px;
    text-decoration:none;
    text-align:top;
}


#contentcontact {
    color:#9ea3ab;
    font-family:Arial;
    font-size:16px;
    padding:5px 30px 5px 50px;
    text-decoration:none;
    text-align:top;
}


h1 {
    color:#9ea3ab;
    font-family:Arial;
    font-size:16px;
    padding:5px 30px 5px 35px;
    text-decoration:none;
    text-align:top;
}   





body {
    height: 100%;
    background-image:url("images/denimbackground.gif"); repeat;
}

【问题讨论】:

  • 请只发布相关代码。
  • 对不起,但我相信我也可以在 FF 和 Chrome 中看到这个问题。我不相信这只是 X-Browser 兼容性的问题。
  • 把这段代码放到网上会更好。并且只在此处发布相关代码

标签: css sticky-footer


【解决方案1】:

如果我删除 #footer CSS 指令中的 position:absolute 对我有用。
包括在 IE 中。

【讨论】:

  • 当我按照 Alain 的指示进行操作时,结果相同。 :)
猜你喜欢
  • 1970-01-01
  • 2016-05-01
  • 2012-10-19
  • 1970-01-01
  • 1970-01-01
  • 2023-04-01
相关资源
最近更新 更多