如何定义多个CSS背景属性?

时间:2012-12-06 14:45:12

标签: html5 css3

是否可以让这些背景一起工作?

background: url("../images/search.png") no-repeat scroll 9px 4px transparent;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #fdca14), color-stop(1, #ff8d02) );
background:-moz-linear-gradient( center top, #fdca14 0%, #ff8d02 100% );

谢谢:)

3 个答案:

答案 0 :(得分:3)

CSS3允许它。以下是在同一背景中使用多个背景图像的示例:

.exampleClass {
    background-image: url(images/example1.png), url(images/example2.png);
    background-repeat: repeat-x, repeat;
}

all major browsers支持它(IE8除外,可悲之前)

答案 1 :(得分:3)

如果您需要在较旧的IE浏览器中执行此操作,您可能还需要查看CSS3 Pie

答案 2 :(得分:2)

<强> CSS

.class{
    background: url("../images/search.png") no-repeat scroll 9px 4px transparent,-webkit-gradient( linear, left top, left bottom, color-stop(0, #fdca14), color-stop(1, #ff8d02) ),-moz-linear-gradient( center top, #fdca14 0%, #ff8d02 100% );
}