Div不会将自己定位在父div的底部

时间:2013-08-26 19:37:34

标签: css

这应该相当简单,但由于某种原因,我无法将我的“页脚”div放在“容器”div的底部。这与主页面格式有关,因此如果我将其调整为在一个页面上看起来不错,则不会在另一个页面上调整。有人可以快速看看并帮助我吗?

#container {
background-color: #fafafa;
height: auto;
width: 1112px;
margin: 0 auto 0 auto;
position: relative;
}

#footer {
background-color: #fafafa;
width: 1112px;
height: 25px;
margin-left: auto;
margin-right: auto;
position: absolute;
bottom: 0;
}

#ftr-nav {
position: absolute;
bottom: 0;
right: 0;
float: right;
padding: 15px 30px 0 0;
}

.ftr-link-home {
font: 9px #0094ff;
}

.ftr-link-admin {
font: 9px #0094ff;
}

#copy {
float: right;
padding: 0 15px 0 0;
font-size: small;
position: absolute;
right: 115px;
bottom: 0;
}

http://jsfiddle.net/Develop_er/c32Mm/2/

2 个答案:

答案 0 :(得分:3)

添加:

html,body
{
   height: 100%;
}
#container {
    background-color: #fafafa;
    height: 100%; /* <--- */
    width: 1112px;
    margin: 0 auto 0 auto;
    position: relative;
}

<强> FIDDLE

答案 1 :(得分:0)

是。向#container添加高度可以使一切正常。

相关问题