1. background-imag属性:
可以添加一张或者多张照片:
代码 background-image:url(http://js.wotucdn.com/2015/image/weili/weili_loading.png), url(http://js.wotucdn.com/2015/image/weili/weili_loadi);
2. background-position属性:
*background-position: right bottom, left top center; * 作用分别是将背景图片放在右边、底、左、上、居中;
3. background-repeat属性:
让背景图片重复铺放:background-repeat: repeat
让背景图片不重复:background-repeat: no-repeat;
可以给不同的图片设置多个不同的属性:
background: url(img1.gif) right bottom no-repeat, url(paper.gif) left top repeat;
4. ackground-size 属性:
ackground-size:60px 80px
设置宽度60px,设置高度80pxbackground-size:100% 100%;
设置背景图完全填充内容区域
5. background-Origin属性:
background-Origin属性指定了背景图像的位置区域
background-origin:content-box
将背景图放在上面图片指定区域
CSS3 多个背景图像
background-image: url(img_flwr.gif), url(paper.gif);
background-position: right bottom, left top;
background-repeat: no-repeat, repeat;
css属性设置背景
属性 | 描述 |
---|---|
background-color | 设置背景颜色 |
background-image | 设置背景图 |
background-position | 设置背景图位置 |
background-repeat | 设置背景图如何重复 |
background-origin | 规定背景图片的定位区域 |
background-size | 规定背景图片的尺寸 |
在水平方向上重复背景图:
background-repeat:repeat-x;
在竖直方向上重复背景图:
background-repeat:repeat-y;
固定背景图:
background-attachment:fixed;