【问题标题】:Transparent image pattern over color in CSSCSS中颜色上的透明图像图案
【发布时间】:2013-03-20 08:48:44
【问题描述】:

我正在尝试在 CSS 中的颜色渐变上添加一个简单的 .png 图案。这是标记:

HTML:

<div class="pattern">
  <div class="widget_heading">
    <h4>Feed</h4>
  </div>
</div>

CSS:

.pattern {
 background: url(../img/leatherpattern.png) repeat;
 }

.widget_heading { 
  display:block; border:1px solid #3F943A; height:40px; border-top-left-radius: 5px  5px;
  border-bottom-right-radius: 5% 0%;
  border-top-right-radius: 5px; background: #3c8522; /* Old browsers */
  background: -moz-linear-gradient(top,  #3c8522 0%, #599d40 100%); /* FF3.6+ */
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3c8522), color-stop(100%,#599d40)); /* Chrome,Safari4+ */
  background: -webkit-linear-gradient(top,  #3c8522 0%,#599d40 100%); 
  background: -o-linear-gradient(top,  #3c8522 0%,#599d40 100%); /* Opera 11.10+ */
  background: -ms-linear-gradient(top,  #3c8522 0%,#599d40 100%); /* IE10+ */
  background: linear-gradient(to bottom,  #3c8522 0%,#599d40 100%); /* W3C */
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3c8522', endColorstr='#599d40',GradientType=0 ); /* IE6-9 */
  }

我不知道为什么它没有出现在上面,但它正在出现。任何帮助将不胜感激,谢谢!

http://jsfiddle.net/j4JjW/3/

【问题讨论】:

标签: html css image design-patterns overlay


【解决方案1】:

你的渐变和你的图片都不是透明的,所以当它们占据相同的空间时是不可能看到的。 As you can see here 渐变只是覆盖了图像,反之亦然。您需要为两者之一提供一些透明度(and put it on top)

【讨论】:

    猜你喜欢
    • 2018-02-23
    • 2012-10-21
    • 1970-01-01
    • 2015-03-09
    • 1970-01-01
    • 1970-01-01
    • 2021-05-13
    • 2012-02-29
    • 2021-10-26
    相关资源
    最近更新 更多