background-color
值为颜色值或transparent
两者选其一,默认值是transparent
(透明)。浏览器
background-image
指定显示的背景图片,用url()
设置路径。url
background-repeat
指定背景图像如何重复的,默认值是repeat
(一直重复,直到整个元素的背景被填充)spa
值 | 描述 |
---|---|
no-repeat | 不重复 |
repeat | 垂直和水平都重复 |
repeat-x | X轴方向(水平)重复 |
repeat-y | Y轴方向(垂直)重复 |
background-position
指定定位背景图片的位置,原点为左上角(0,0)。code
left
,center
,right
,top
,bottom
)center
background-position:9px top;
background-attachment
指定当内容滚动时背景如何滚动。图片
值 | 描述 |
---|---|
scroll | 默认值。滚动,背景图随着页面的滚动而移动。 |
fixed | 固定,当页面的其他部分滚动时,背景图像不会移动。 |