html - CSS 中彩色透明图像图案

标签 html css image design-patterns overlay

我正在尝试在 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/

最佳答案

你的渐变和你的图像都不是透明的,所以当它们占据相同的空间时是不可能看到两者的。 As you can see here渐变只是覆盖了图像,反之亦然。您需要给两者之一一些透明度 (并将其放在顶部)

关于html - CSS 中彩色透明图像图案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15512993/

相关文章:

javascript - THREE.js 通过对象克隆实现多个 Canvas 的多个 View 。陷阱?

页面加载时不应用 css 规则

css - 如何禁用单击以在纯 css slider 上前进

mysql - 处理上传的大量图像的最佳目录结构是什么?

html - 设置vue模态掩码模糊

html - 如何在 div 元素内将图像居中 (HTML)

c# - 专注于文本框

css - 当父 DIV 具有最小高度时,无法在子 DIV 中使用百分比高度吗?

OpenGL ES 纹理的图像大小

python - 保存名称中带有撇号的文件(Python 3.4)