网络图片:
background: url(https://58d.oss-cn-hangzhou.aliyuncs.com/website2022/shoes.png);
本地图片:
1.项目内部:
background: url(../src/img/app.png);
2.本机文件:
background: url(file:///D:/APP/src/img/app.png);
另附:
| 参数 | 描述 | 值 |
|---|---|---|
| background-color | 设置元素的背景色。 |
|
| background-image | 设置背景图像。 |
|
| background-repeat | 设置背景图像是否及如何重复。 |
|
| background-attachment | 背景图像是否固定或者随着页面的其余部分滚动。 |
|
| background-position | 设置背景图像的起始位置。 |
|
本文详细介绍了CSS中背景属性的使用方法,包括背景颜色、背景图片的设置方式,以及如何控制背景图片的重复、定位和固定等特性。适用于前端开发者快速掌握CSS背景属性的应用技巧。
2766

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



