5.6. CSS background 属性
background -- 五个背景属性可以全部在此定义
- 取值:
[<background-color> || <background-image> || <background-repeat> || <background-attachment> || <background-position>] | inherit
- [<background-color> || <background-image> || <background-repeat> || <background-attachment> || <background-position>]: 背景颜色,图像等的一个属性或多个属性
- inherit: 继承
- 初始值: 根据五个背景属性的默认值
- 继承性: 否
- 适用于: 所有元素
- 引用网址:http://www.dreamdu.com/css/property_background/
- background:中文"背景"的意思
说明
前面的讲的五个背景属性完全可以使用background属性代替.
示例
body{background:transparent url('list-orange.png') repeat-x scroll center center;}
使用background解决所有问题.
body{background:url('list-orange.png') repeat-x scroll center center;}
由于背景颜色background-color的默认值为transparent,所以可以省略,这个例子和上面的例子是等价的.
body{background:url('list-orange.png') repeat-x center;}
由于背景图片随滚动轴的移动方式background-attachment的默认值为scroll,所以可以省略,背景图片的位置background-position中的属性值center center等价于center,这个例子和上面的例子也是等价的.