Css 绝对位置在相对主体内不工作
我正在使用Bootstrap3创建布局,我不确定这是否相关。html/body元素设置为height:100%,我甚至在body上设置了minheight:100%,body设置为positionrelativeCss 绝对位置在相对主体内不工作,css,twitter-bootstrap,Css,Twitter Bootstrap,我正在使用Bootstrap3创建布局,我不确定这是否相关。html/body元素设置为height:100%,我甚至在body上设置了minheight:100%,body设置为positionrelative html, body { height: 100%; margin: 0; padding: 0; } body { min-height: 100
html, body {
height: 100%;
margin: 0;
padding: 0;
}
body {
min-height: 100%;
font-size: 16px;
background-color: rgb(232, 232, 232);
font-family: Calibri;
position: relative;
}
在主体内部,在其下方的水平面上,是我的页脚,绝对位于底部:0。然而,无论我多么希望它出现在页面底部,它都不会出现在页面底部
.footer {
color: white;
background: url(Images/images/footer_bg.gif) repeat-x;
padding-top: 10px;
padding-bottom: 9px;
padding-left: 30%;
}
.footerContainer {
width: 100%;
margin: 0;
padding: 0;
margin-top: 60px;
position: absolute;
right: 0;
left: 0;
}
页脚是身体的直接子体,也就是说,它根本不隐藏在任何其他东西里面。下面是页脚的标记:
<div class="container footerContainer">
<div class="row footer">
<div class="col-md-12"><p>Content</p></div>
</div>
内容
正如我之前所说,这不是在任何其他分区,只是身体。这里可能有什么问题 没有
底部:0代码>在您的示例中。这似乎是个问题
.footerContainer {
width: 100%;
margin: 0;
padding: 0;
margin-top: 60px;
position: absolute;
border:1px solid;
bottom:0;
}
这是一个演示,其中包含您的代码:(使用bootstrap 3)
您能创建一个JSFIDLE吗?使用DOM检查器验证height:100%是否实际工作。通常,我使用一种非常恼人的方法将页脚保持在底部,但是Bootstrap有一个很好的例子:在您的代码示例中,我没有看到任何bottom:0
,这很好