Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想扩展 div 标签以适应手机屏幕高度
<div id="header"></div> <div id="container"></div> <div id="footer"></div>
页眉和页脚没有固定的高度值,我想让容器适合剩余的屏幕高度。
当我使用:
html , body {height:100%;} #cointainer{height:100%;}
我必须滚动才能显示页脚。
所以我希望页眉和页脚height:auto以及容器占据剩余的高度。
height:auto
好吧,你可以做一些数学运算,取窗口高度并减去页脚和页眉高度,这就是容器高度。再见。