2012-07-01 306 views
3

背景图像不能出现下面的CSS:背景渐变+单背景图片

background: -webkit-linear-gradient(#fcfcfc,#cbcbcb); 
    background-image: url("../images/new/account-dropdown.png") no-repeat 100%; 

我怎么会做正确的上面?

仍然没有收到正确的答案,可以正常工作......与此同时,我正在使用额外的<img>标签,该标签绝对位于渐变的上方。

+2

http://stackoverflow.com/questions/2504071/is-it-possible-to-combine-a-background-image-and-css3-gradients – Luca

+0

这提供了一个很好的答案,但没有解释对于我需要的“不重复的100%”部分。 – David542

+0

是否:'background-image:url(“../ images/new/account-dropdown.png”)不重复100%,-webkit-linear-gradient(top,#444444,#999999);/* Chrome 10+,Saf5.1 + * /'(来自@ Luca的链接)不起作用? – RichardTowers

回答

0

尝试这种情况:

background-image: url("../images/new/account-dropdown.png"); 
background-size: 100%; 
background-origin: content; 
+0

不,只要图像正确显示,这个“工作”,但它会杀死渐变。 – David542

0

RichardTowers接近,但梯度需要是图像之前:

background-image: -webkit-linear-gradient(top, #444444, #999999), url("../images/new/account-dropdown.png") no-repeat 100%; 
+0

这不起作用。 – David542

0

先给z索引属性来显示比其他一个背景。