background背景
一、 背景颜色;
background-color
二、背景图片;
1、背景图片:background-image:url('图片路径')
2、背景图片是否重复平铺 background-repeat:
a、background-repeat:repeat;默认平铺
b、background-repeat:no-repeat;不平铺
c、background-repeat:repeat-x; 水平方向平铺
d、background-repeat:repeat-y; 垂直方向平铺
3、背景图片的定位 background-position:水平方向 垂直方向;
a、background-position:left/center/right top/center/bottom;
b、background-position:x y; x-水平方向的数值;y-垂直方向的数值;单位:px;
c、background-position:50% 50%;水平、垂直方向居中(0% 0%左上角;100% 100%右下角;)
4、背景图片的固定 background-attachment:
a、background-attachment:scroll;
scroll 默认值,背景图会随着页面其余部分的滚动而移动。
b、background-attament:fixed;
fixed 当滚动条滚动时,背景图不会移动。
5、复合属性
background:color url(‘路径’) repeat center center fixed;
按顺序写,当有的属性没值时,可以不写。