min-height
更合适吗?
或者就此而言,将我的全屏背景设置为html
和body
是否合适?这可以单独设置为html
吗?
html, body {
height: 100%;
background-image: url(blah.jpg);
background-size: cover;
background-position: center center;
}
答案 0 :(得分:0)
所有内容都是在body
上绘制的,html是主要文档,如果您可以提供样式但不强烈推荐,因为body
和html
相同。
min-height
。
*{
margin: 0;
padding: 0;
}
body {
background-image: url(blah.jpg);
background-attachment: fixed;
top: 0px;
left: 0px;
background-size: cover;
background-position: 50% 50%;
background-repeat: none;
}