我已经根据 this answer 中的 css 和 html 设置了一个内容区域固定宽度和可变高度、水平和垂直居中的网站。 .
这在我测试过的所有浏览器中都运行良好,即使在 IE (11) 中也是如此。然而,该页面也需要在全屏模式下工作,如果我在 ie 中运行它,内容会转到左上角。
这是我的 html:
div.wrapper-1 {
display: table;
position: absolute;
height: 100%;
width: 100%;
}
div.wrapper-2 {
display: table-cell;
vertical-align: middle;
}
div.wrapper-3 {
margin: 0px auto;
width: u($page-width);
}
<body>
<div class="wrapper-1">
<div class="wrapper-2">
<div class="wrapper-3">
<!-- does all my content go -->
</div>
</div>
</div>
</body>
我该怎么做才能使它在全屏模式下也能正常工作?
感谢您的帮助!
最佳答案
最后,在深入研究之后,我可以启动并运行它!
我将其添加到我的 CSS 中:
html {
width: 100%;
height: 100%;
}
关于html - IE——全屏,内容居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25935067/