【发布时间】:2015-08-11 06:06:14
【问题描述】:
我想我尝试了 stackoverflow 上发布的所有解决方案,但肯定是正确的解决方案。 2 小时什么都没有,然后给 div 一个 100% 的高度,非常令人沮丧。
也许我只是累了(德国之夜),有人在几秒钟内就看到了正确的解决方案。
一切看起来都很棒,除了具有可重复背景图像的“layout_content_middle”类的 div。 “id=content” div 具有正确的 100% 高度,但内容 div 内的 conainer div 没有,这就是问题所在。
这是我当前的代码。 重要说明,这是一个引导项目,所以我使用容器和网格类。
html,
body {
height: 100%;
}
#content {
min-height: 100%;
height: auto !important;
height: 100%;
/* Negative indent header and footer by its height */
margin: -80px auto -165px;
/* Pad bottom by header and footer height */
padding: 80px 0 165px;
}
/* Set the fixed height of the header here */
#header {
height: 80px;
}
/* Set the fixed height of the footer here */
#footer {
height: 165px;
}
<div id="header">
<div class="container" style="max-width: 983px">
<div class="row">
<div class="col-xs-12">
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="layout_content_top"></div>
</div>
</div>
</div>
</div>
<div id="content">
<div class="container" style="max-width: 983px; background-color: red; height: 100%">
<div class="row">
<div class="col-xs-12">
<div class="layout_content_middle">
asdasd asd ad as das d as
<br />asd
<br />asd
<br />asd
<br />asd
<br />asd
<br />asd
<br />asd
<br />
</div>
</div>
</div>
</div>
</div>
<div id="footer">
<div class="container" style="max-width: 983px">
<div class="row">
<div class="col-xs-12" style="padding-left: 16px">
<div class="layout_footer"></div>
</div>
</div>
</div>
</div>
【问题讨论】: