【问题标题】:Css Background with a transparent image and a gradient带有透明图像和渐变的 Css 背景
【发布时间】:2012-10-15 22:56:53
【问题描述】:

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

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);
}

【问题讨论】:

  • 尝试将“background-image”改为“background”
  • 我等不及要停止使用供应商前缀了。

标签: html css image background gradient


【解决方案1】:

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

尝试类似:

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;
}

【讨论】:

猜你喜欢
  • 2011-08-06
  • 1970-01-01
  • 2015-11-12
  • 1970-01-01
  • 2015-08-29
  • 1970-01-01
  • 2013-11-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多