css如何使background-img填满整个页面
可以使用以下CSS代码实现:
html, body {
height: 100%;
}
body {
background-image: url("your-image-url");
background-repeat: no-repeat;
background-size: cover;
}
其中,将html和body元素的高度设置为100%,使它们占据整个页面的高度,然后将背景图像设置为body元素的背景图像,并将重复属性设置为no-repeat,使图像不重复。最后,将背景大小设置为cover,以使图像填满整个屏幕。
原文地址: https://www.cveoy.top/t/topic/cRfH 著作权归作者所有。请勿转载和采集!