背景颜色:
Background-color: 颜色值
背景图片:
Background-image: url(图片文件相对路径)
可以放入两张图片,两张图片会合成一张图片。
背景图片是否重复显示:
Background-repeat:设置值
Repeat:重复并排显示
Repeat-x:水平方向重复显示
Repeat-y:垂直方向重复显示
No-repeat:不重复显示
背景图片是否与滚动条一起滚动
Background-attachment:设置值
Fixed:固定不动
Scroll:随动
Background-position: x位置 y位置
如果不填,默认是50%的值
也可以是:
Left center right top bottom
背景尺寸
Background-size:” 数值 数值”
Cover 充满背景
Contain 符合背景大小,不超出组件
背景渐变;
Linear-gradient(渐变方向,色彩1,位置1,色彩2,位置2,...)
top表示由上至下, left表示由左至右, 45度....