【发布时间】:2015-08-12 23:56:22
【问题描述】:
我有两个 div。一个是我的页面的正文,另一个是我的页面的页脚。即使我调整浏览器窗口的大小,页脚 div 也应该有 100% 的宽度。
我的网页是这样的:
当我调整浏览器窗口大小时,会出现滚动:
如果我水平滚动页面,我的页脚不再是宽度的 100%:
我应该怎么做才能使页脚 div 始终保持 100% 的宽度?
<body>
<div id="header"></div>
<div id="footer"></div>
</body>
#header {
height: 500px;
width: 1100px;
margin: 0 auto;
background: grey;
}
#footer {
background: #6B191C;
position: absolute;
left: 0;
height: 100px;
width: 100%;
margin-top: 60px;
}
【问题讨论】: