background-color
作用: 背景颜色
值: 预定义的颜色/十六进制/RGB代码
语法:background-color:颜色值;
background-image
作用: 背景图片
值: url(路径)
语法:background-image:url()或background-image:none
background-image:url(image/png); /使用绝对或相对地址来指定背景图/
background-image:none /表示无背景图/
background-repeat
作用: 是否平铺
值: repeat/repeat-x/repeat-y/no-repeat
background-repeat:repeat /默认值,即横向纵向平铺/
background-repeat:repeat-x /横向平铺/
background-repeat:repeat-y /纵向平铺/
background-repeat:no-repeat /背景图不平铺/
background-position
作用: 背景位置
值: length/position 分别是x和y值 如果有精确单位必须按照先X后Y顺序
background-position:center center; /背景图居中/
background-position:10px 50px; /据横轴10px 纵轴50px/
注意:使用background-position前必须先指定background-image
background-attachment
作用: 背景固定还是滚动
值: scroll/fixed
background-attachment:scroll; /背景图滚动/
background-attachment:fixed; /背景图固定/
背景简写(没有顺序)
背景颜色 背景图片地址 背景平铺 背景滚动 背景位置
背景透明
作用: 让盒子半透明
background: rbga(0,0,0,0.3);
注意:最后一个参数为透明度,取值范围在0-1之间