我尝试设置背景图像body
像为:如何在整页上制作背景图片?
body {
background: url("http://beerhold.it/1024/800") center bottom;
z-index: 10;
height: 100%;
background-repeat: no-repeat;
background-size: cover;
}
但只有部分
我尝试设置背景图像body
像为:如何在整页上制作背景图片?
body {
background: url("http://beerhold.it/1024/800") center bottom;
z-index: 10;
height: 100%;
background-repeat: no-repeat;
background-size: cover;
}
但只有部分
不要ü使用高度它显示的图像:100%。这个高度基于内容的高度。不是一个parrent块。
body {
background: url("http://beerhold.it/1024/800") center bottom;
z-index: 10;
min-height: 100vh;
background-repeat: no-repeat;
background-size: cover;
margin: 0;
}
添加到您的代码
background: url("http://3ksks.com/pic.jpg");
background-size: 100% auto;
body {
background: url("http://beerhold.it/1024/800") center bottom;
background-size: 100% 100%;
background-repeat: no-repeat;
background-size: cover;
}
的高度,它的工作就像前面的代码 – Dev