背景图片的定义
背景图象重复与否
background-repeat:
repeat | repeat-x | repeat-y | no-repeat
注:
以上设置标签的意义
repeat 图象水平垂直方向都重复。
repeat-x 图象水平方向重复。
repeat-y 图象垂直方向重复。
no-repeat 图象不重复。
背景图象是否随滚动条移动:
background-attachment:
scroll | fixed
scroll属于浏览器默认的,也就是随滚动条移动,fixed为不动。
给背景图定位:就是设置它显示在哪里.最上面top,还是左边left
background-position:
| [percentage | length]{1,2}
|[top | center | bottom]
| [left | center | right]
background-position:[percentage | length]是用X(横坐标)y(纵坐标)定义,
如background-position: 20px 40px;
background-position:[top | center | bottom] 和[left | center | right]
是一样的意思了,三个任意两个搭配可以产生不同的效果.
可以是background-position:top center;center bottom;top bottom;left,right.....
bottom:下,top:上,left:左,right:右,center:中.
全部的设定:
{ background: background-color || background-image || background-repeat || background-attachment || background-position }
例如:
BODY {background-image: URL(picture1.jpg);
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;}
定义背景图的属性,位置是居中,不重复码放,且固定。
