背景的简写属性
可以把背景的各个属性合为一行,而不用每次都单独把他们写出来。格式如下:
background: <color> <image> <position> <attachment> <repeat>
例如,下面的声明
background-color: transparent;
background-image: url(image.jpg);
background-position: 50% 0 ;
background-attachment: scroll;
background-repeat: repeat-y;
可以合为单独一行:
background: transparent url(image.jpg) 50% 0 scroll repeat-y;
而且不需要指定每一个值。如果省略值地话,就使用属性地默认值。例如,上面那行和下面这个效果一样:
background: url(image.jpg) 50% 0 repeat-y;