CSS背景
背景颜色
background-color:transparent(透明 默认);
background-color:颜色;
背景图片
background-image: none | url(图片地址);
背景平铺
background-repeat:repeat | no-repeat | repeat-x | repeat-y;
repeat:图片在纵向和横向上平铺。
no-repeat:图片不平铺。
repeat-x:图片横向平铺。
repeat-y:图片纵向平铺。
背景图片位置
background-position:x y;
如果x y参数是方位名词,如right center,两个值的前后顺序无影响。如果只指定了一个方位名词,另一个默认居中对齐。
如果x y参数是精确单位,那么第一个一定是x坐标,另一个是y坐标,如果只有一个数值,该数值一定是x坐标,另一个默认垂直居中。
如果x y参数是混合单位,第一个值一定是x 坐标,第二个值是y坐标。
背景图像固定
background-attachment : scroll | fixed;
scroll:图片随对象滚动。(默认)
fixed:图片固定。
背景复合写法
background:color image repeat attachment position;
没有顺序要求,但一般按颜色、图片、平铺方式、滚动方式、图片位置写代码,空格隔开。
背景颜色半透明
background: rgba(颜色数值,颜色数值,颜色数值,透明度(取值0-1之间));