背景属性
- background-color:设置背景颜色,应用到border
- background-image:设置背景图片,从padding开始渲染,设置平铺后会应用到border
- background-repeat:设置背景平铺
- no-repeat
- repeat默认值
- repeat-x
- repeat-y
- background-position:用于背景定位(从padding开始定位)
- 数值法:background-position:100px 200px; 向右平移100px,向下平移200px
- 特殊变量:left/right/center、top/bottom/center
- 百分比:x|y=(width|height-图片宽|高)*百分比
- background-attachment:用来固定背景
- scroll:默认值
- fixed:滚动页面时,相对窗口位置不变。从html元素左上角开始渲染
优先显示背景图片