背景
API知识,比较简单
background-image
background-repeat
1.background-size:
- contain 宽度固定拉伸,高度自适应
- auto 不拉伸
- cover 宽高同比例方法拉伸
- 设置具体大小
2.background-position
- 移动位置 具体值
- 水平方向 left centert right
- 垂直方向 top center bottom
设置一个方向,另一个默认center
3.background-attachment
背景相对于视口的位置
- scroll 相对于元素固定
- local 内容随着元素一起滚动
- fixed 相对于浏览器视口固定
4.简写格式
background:color || image || ?..
不好用,不能言简意赅
img与background-image对比