background属性的简写方式包含五种属性值
background-color,
background-image,
background-repeat,
background-attachment,
background-position。
举例:
background: #ccc none repeat scroll 0 0;
background:transparent none repeat scroll 0% 0%
分别代表:背景属性:背景颜色 背景图片 背景是否重复 背景时候随浏览器滚动 背景平位置 背景垂直位置
其中:
transparent表示透明无颜色
none 表示没有设置背景图片
repeat 表示图片重复
scroll 表示背景图片随浏览器下拉而滚动
0%水平位置在x0
0%垂直位置在y0
background: [background-color] [background-image] [background-repeat]
[background-attachment] [background-position] / [ background-size]
[background-origin] [background-clip];
background-position 属性设置背景图像的起始位置
background-positon:属性值;
第一种情况background-position:x(数值),y(数值);
说明:
x(数值) 设置网页的横向位置
y(数值) 设置网页的纵向位置
第一种情况background-position:top,left;
说明:
top left 左上
top center 靠上居中
top right 右上
left center 靠左居中
center center 正中
right center 靠右居中
bottom left 左下
bottom center 靠下居中
bottom right 右下