我怎样才能使内部的div延伸到容器大小的100%?请考虑下面的示例,我想要.footer是实际.wrapper大小的100%(500px,因为.content内部元素的宽度为500px)。
<html>
<head>
<style type='text/css'>
.wrapper {
width: 300px;
text-align: center;
overflow: auto;
}
.content {
width: 500px;
background-color: green;
}
.footer {
background-color: grey;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="content">PAGE CONTENT</div>
<div class="footer">FOOTER (should be 100%)</div>
</div>
</body>
</html>
如果你看一看http://jsfiddle.net/6at8Q/然后向右滚动,你会看到灰色条不会延长。
另外... http://stackoverflow.com/questions/6314993/div-fill-parent-container – JohnFx
divs默认是他们父母的宽度的100%。 – GolezTrol
另外... http://stackoverflow.com/questions/7675107/make-a-div-fill-the-whole-page-in-height – JohnFx