【发布时间】:2015-01-18 05:05:14
【问题描述】:
我有一个结构如下的网站:
<html>
<body>
<div id="page">
<div id="anyContent"></div>
<div id="pagecontent">
<div id="bigContent"></div>
<div id="footer"></div>
</div>
</div>
</body>
</html>
bigContent 是动态的,通常会延伸到大尺寸(通过它的宽度和高度来证明)。因为很多元素是动态渲染到 div 中的,bigContent 没有设置为静态宽度。
如何强制页脚与bigContent 具有相同的宽度?
请参阅我的示例 jsFiddle。
html {
margin: 0;
padding: 0;
height: 100%;
min-width: 100%;
}
#page {
min-height: 100%;
min-width: 100%;
position: relative;
}
#bigContent {
background: black;
height: 3000px;
width: 5000px;
}
#footer {
background: blue;
clear: left;
bottom: 0px;
width: 100%;
height: 100px;
}
【问题讨论】:
-
在你的小提琴中看起来 100% 对我来说 - Chrome 64bit W7
-
检查我的答案是你追求什么? @疯子
-
由于您将内联样式设置为 div#bigContent width=5000px;您可以设置页脚宽度=5000px 将解决问题
标签: html css sticky-footer