背景图属性
- 设置背景颜色
background-color
- 设置背景图
background-image: url(IMAGE_PATH);
这里路径为相对路径。
- 是否平铺
background-repeat
- 平铺(默认):
repeat
- 不平铺:
no-repeat
- 横铺:
repeat-x
- 竖铺:
repeat-y
- 平铺(默认):
- 背景位置
background-position:[A][空格][B]
- A, B可选像素或者
botton, top, right, left
- A为横向方位,B为纵向方位,若只写了一个则另一个默认居中。如常用
background-position: centor 0px
是左右居中,上下顶上部。
- A, B可选像素或者
- 背景是否跟着滚动而滚动
background-attachment
- 动:
scroll
- 不动:
fixed
- 动: