我已经尝试了很多方法来使用 css calc 和表格布局来获取滚动条。下面是我的小提琴。任何帮助是极大的赞赏。
JSFIDDLE:http: //jsfiddle.net/y3U8F/124/
在这里,我想要滚动条#content
HTML:
<div class="displayTable">
<div class="displayTableCell">
<div id="content">
body content<br>body content<br> ...
</div>
<footer>copyright etc</footer>
</div>
</div>
CSS:
html, body {
height: 100%;
}
#content {
height: -webkit-calc(100% - 50px);
background-color: yellow;
overflow:auto
}
footer {
height: 50px;
background-color: grey;
}
.displayTable{display:table;table-layout:fixed;width:100%}
.displayTableCell{display:table-cell}