由于某种原因,我无法让 html 和 body 具有 100% 的高度,我正在努力找出原因。我正在使用以下代码并在网络和 Stackoverflow 上搜索答案,但似乎没有任何效果:
html, body {
height: 100%;
min-height: 100% !important;
width:100%;
padding:0;
margin:0;
line-height:normal;
}
这是一个现场演示:
知道发生了什么吗?
最佳答案
在 html
上设置 height: 100%
会强制其高度为视口(viewport)的高度(导致截断)。尝试将 html
的高度设置为 auto
或从 html, body
规则中删除 html
。
关于html - 背景用 html 和 body 100% 高度切断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31193297/