1. 属性值:
red,yellow,green,blue,white,gray,skyblue,purple,gold,brown,pink,yellowgreen,orange,
rgb取值范围:0~255;
background-color: rgb();
rgba:前三个值代表色值,第四值个是透明度(作用于背景颜色)
background-color: rgba(10,150,110,0.5);
16进制表示法:
background-color: #ccb;
2.background-image: url(1.jpg);背景图的平铺方式:
background-repeat: no-repeat;
no-repeat:不平铺
repeat-y:纵向平铺;
repeat-x:横向平铺;
repeat:默认纵向横向都平铺
3.设置背景是否固定
background-attachment: scroll;
scroll:默认背景图跟内容一起滚动;
auto:上下滚动
fixed:背景图不随内容的滚动而滚动
4.图片定位:background-position;
第一个值是x方向;第二个值是y方向
1.具体值;
2.百分比
3.水平方向:x方向,left,center,right;
4.垂直方向:y方向:top,middle,bottom.
background-position:
有两个参数,分别是水平方向移动的像素、竖直方向移动的像素,都用负数表示。
大图不动,div移动,也只能是向右、向下移动,只要记住这两个方向移动的像素都用负数表示就行了!
合着写:
background:color url() repeat position(定位) attachment(固定)