[2016-01-17][CSS][背景相关的属性]- 背景相关的属性
- background-coclor设置背景颜色
- background-image 设置背景图片
- background-image:"图片url";
- background-image:none;无,默认值
- background-image:inherit;继承父元素
- background-repeat:设置是否以及何如重复背景图像
- background-repeat:repeat;默认,背景图片在水平和垂直反向重复
- background-repeat:repeat-x;背景图像在水平方向重复
- background-repeat:repeat-y;背景图像在垂直方向重复
- background-repeat:no-repeat;背景图像仅显示一次
- background-repeat:inherit;继承父级元素
- background-position:设置图像的开始位置
- 有两个值,第一个值描述x,第二值描述y
- left 左
- right 右
- center 中
- top 顶
- bottom 底
- x% y%
- xpx ypx
- 如果只规定了一个值,另一个值默认是50%(没错不是px是%)
- background-attatchment:设置背景图像是否随着页面的其他部分移动
- background-attatchment:scroll 默认值,移动
- background-attatchment:fixed 固定
- background-attatchment:inherit 继承父元素
- background-clip 规定背景的绘制区域
- background-clip:border-box;背景被裁剪到边框盒
- background-clip:padding-box;背景被裁剪到内边距边框
- background-clip:content-box;背景被裁剪到内容框
- background-origin 规定background-position属性是相对什么位置来定位的额
- background-origin:padding-box背景相对于内边距框来定位
- background-origin:border-box;背景相对于边框盒来定位
- background-origin:conten-box;背景相对于内容匡来定位
- background-size 规定背景图像的尺寸
- background-size:宽度 高度
- background-size:% %
- background-size:cover;扩大图像到适合边框为止(即放大图像,然后放进,图像可能有一部分不在边框内)
- background-size:contain;拉伸图像到适合边框为止
[2016-01-17][CSS][背景相关的属性]
原文:http://www.cnblogs.com/qhy285571052/p/5137518.html