1、首先准备一个div
<div id="background"></div>
2、编写css
#login {
background: url("../assets/images/content.jpg") no-repeat;
background-position: center;
height: 100%;
width: 100%;
background-size: cover;
position: fixed;
}
3.大功造成
本文介绍如何使用CSS设置div元素的背景图片,包括图片路径、位置、大小和固定属性的详细配置。
1、首先准备一个div
<div id="background"></div>
2、编写css
#login {
background: url("../assets/images/content.jpg") no-repeat;
background-position: center;
height: 100%;
width: 100%;
background-size: cover;
position: fixed;
}
3.大功造成
1万+

被折叠的 条评论
为什么被折叠?