我在尝试使用calc()函数让我的页面内容完美地适应页面。我的页眉高度为52像素。我要让一个容器占据整个页面减去50像素的宽度,这样它就可以完美地适应页面,然而,在Chrome、Edge和Internet Explorer中它可以工作,但在Firefox中则不行。
Chrome: Chrome结果 Firefox: Firefox结果
Chrome: Chrome结果 Firefox: Firefox结果
div#container {
width: 20%;
height: 100%;
height: calc(100% - 52px);
height: -moz-calc(100% - 52px);
height: -webkit-calc(100% - 52px);
float: left;
}
<div id="container"></div>