繁体   English   中英

具有透明图像和渐变的CSS背景

[英]Css Background with a transparent image and a gradient

我该怎么做? 我所拥有的是这些图像和这些gradiente,但我仅显示了渐变,而不是两者都显示。

div {
    background: url(/Icons/icon.png) no-repeat;
    background-image: -moz-linear-gradient(top, #a2a2a2, #878787);
    background-image: -ms-linear-gradient(top, #a2a2a2, #878787);
    background-image: -o-linear-gradient(top, #a2a2a2, #878787);
    background-image: -webkit-linear-gradient(top, #a2a2a2, #878787);
    background-image: linear-gradient(top, #a2a2a2, #878787);
}

听起来好像您想要多个背景图像。 从逻辑上讲,似乎渐变是背景色,但浏览器将“渐变”信息视为背景图像。

尝试类似:

div{
    background-image: -moz-linear-gradient(top, #a2a2a2, #878787), url(/Icons/icon.png);
    background-image: -ms-linear-gradient(top, #a2a2a2, #878787), url(/Icons/icon.png);
    background-image: -o-linear-gradient(top, #a2a2a2, #878787), url(/Icons/icon.png);
    background-image: -webkit-linear-gradient(top, #a2a2a2, #878787), url(/Icons/icon.png);
    background-image: linear-gradient(top, #a2a2a2, #878787), url(/Icons/icon.png);
    background-repeat: no-repeat, no-repeat;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM