2014-02-24 24 views
0

我试图使用下面的代码水平使用不同的背景图像,但只有最后一个图像出来。一个又一个的背景图像,怎么样?

.wallP{background-image:url(images/arc.png) centre left, 
url(images/bg_st.png); 
background-repeat:repeat-x; 
} 
+1

如果这是它如何写在你的CSS,我很惊讶什么都显示在所有。你可以使用'url(..)'的[comman-separated list](http://www.w3.org/TR/css3-background/#the-background-image)作为background-图像属性。 –

+0

我现在唯一得到的是另一个,但我希望他们是一个又一个水平如墙纸。 – user3346439

回答

0

每个元素只能有1个背景图片。

你可以将它们混合在一起,并有一个精灵显示它。

或者,创建不同的元素:

<div id="one"></div> 
<div id="two"></div> 
<div id="three"></div> 

然后给他们所有单独的背景:

#one{ 
    background:url(images/arc.png); 
} 
#two{ 
    background:url(images/bg_st); 
} 
#three{ 
    background:#0f0f0f; 
} 

此外,您发布的任何代码,它不会显示。它有各种错误:

background-image:background-image:url 
       ^only need the one background-image 

url(images/bg_st.png; 
       ^missing a ')' 
相关问题