我正在尝试做一个简单的结构。
标题(35 像素高度)、容器(100% 高度)和底部(35 像素高度)。
为此,我使用 height: calc(100% - 72px);高度:-webkit-calc(100% - 72px);高度:-moz-calc(100% - 72px)
,但不适用于 Safari v5 和 IE ...
我也尝试过使用 magin-top
但是......这是浪费时间。
拜托,有人可以帮助我吗?我需要与 jsfiddle 相同的结果但与 IE 和 Safari V5 兼容 ...
提前致谢。
最佳答案
如果 header 和 bottom 的高度是固定的,那么剩下的就很简单了:
html,
body { height:100%; }
* { box-sizing: border-box; margin:0; padding:0; }
header,footer { height: 35px; background: #0ff; color: #fff; position:absolute; left:0; right:0;}
header { top:0; }
footer { bottom:0; }
.container { background: #0f0; height: 100%; padding: 35px 0;}
<header>Header</header>
<div class="container">
Container
</div>
<footer>Footer</footer>
关于html - 容器高度 100% - px,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26897880/