我有一个页面上有两个 div
,它们应该填满整个屏幕。
它们都具有宽度为100%。
上面的那个 div
的高度应该由其内容定义(适合所有内容的最小可能高度),并且永远不显示任何滚动条。
下面的那个 div
应该填充剩余的屏幕。但是,如果其内容不适合 div
,则应显示垂直滚动条。
就像这样:
<div id="header">This block should not display the scrollbars</div>
<div id="content">This block should fill the rest of the screen and show the vertical scrollbar if the content does not fit</div>
我该如何使用 CSS
实现呢?
更新:
我正在寻找一种解决方案,不需要我为上部分设置固定高度。
这可行吗?