我需要创建元素,它覆盖整个页面,除了所有边的 20px 边距。我试试这个,它适用于 webkit 浏览器和 Firefox,但是 Internet Explorer (10) 和 Opera 有这个问题:-(。知道如何解决这个问题吗?
HTML
<div id="first">
<div id="second">
Hello world!
</div>
</div>
CSS
head, body
{
width: 100%;
height: 100%;
}
body
{
position: absolute;
margin: 0;
background-color: blue;
display: table;
}
#first
{
display: table-cell;
height: 100%;
width: 100%;
padding: 20px;
}
#second
{
height: 100%;
width: 100%;
background-color: white;
}