background 背景(集合样式)
background-color 背景颜色
background-image 背景图片 (添加路径 url())
同一个元素可以拥有多个背景,用逗号分开,先写的背景在上面
background-repeat 背景图片平铺方式
no-repeat(不平铺)
repeat(平铺)
repeat-x (水平平铺)
repeat-y (纵向平铺)
background-postion 背景定位
关键字
x:left center right
y:top center bottom
数值
x:10px/20% (像素大小/百分比)
y:10px/20%
background-attachment:fixed 固定图片不动
background-origin 背景图位置
border-box (在外边框)
padding-box (默认)
content-box (在内边框)
background-clip 背景裁切
-webkit-text (文字背景,只限谷歌)
border-box (默认)
padding-box(在外边框)
content-box (在内边框)
background-size 背景图大小(!!!手机端不建议使用)
等比放大:contain(包含)
cover (覆盖)
本文详细介绍了CSS中背景属性的各种设置选项,包括背景颜色、背景图片、背景图片的平铺方式、定位、固定、裁切及大小调整等内容。适用于前端开发者快速掌握背景样式的设置。
729

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



