css - 多重背景 : Semi-Transparent Color on a BG

标签 css background background-image background-color

我正在尝试在背景图像之上创建一个具有半透明颜色的背景。现在我使用 RGBA 作为颜色背景层的半透明,但网页只显示图像。

我想做的是让一个元素在滚动页面时隐藏在后面并且不可见,并且该元素在我的固定标题后面,如果标题下有文本,它看起来很糟糕。

随时要求澄清。

图像: 不滚动时是什么:http://prntscr.com/7llsd8 滚动:http://prntscr.com/7lls40

代码:

#headerbg {
  position: fixed;
  top: 0px;
  left: 0px;
  width: 100%;
  z-index: 2;
  background: rgba(255, 153, 0, 0.79), url(../images/bg.png);
  -webkit-box-shadow: 0px 3px 18px -1px rgba(21, 20, 19, 1);
  -moz-box-shadow: 0px 3px 18px -1px rgba(21, 20, 19, 1);
  box-shadow: 0px 3px 18px -1px rgba(21, 20, 19, 1);
}
<div id="headerbg">
  <div class="container">
    <div class="row">
      <div class="five columns">
        <img src="images/thv-header.png" id="header">
      </div>
      <div class="seven columns">
        <nav>
          <ul>
            <li><a href="#about">About</a>
            </li>
            <li><a href="#contact">Contact</a>
            </li>
            <li><a href="#designers">Designers</a>
            </li>
          </ul>
        </nav>
      </div>
    </div>
  </div>
</div>

最佳答案

查看下面的更新代码。现在页眉具有背景颜色和多个背景图像

#headerbg {
  position: fixed;
  top: 0px;
  left: 0px;
  width: 100%;
  z-index: 2;
  background-color: rgba(255, 153, 0, 0.79);
  background-image: url(http://www.transparenttextures.com/patterns/back-pattern.png), url(http://www.transparenttextures.com/patterns/batthern.png);
  -webkit-box-shadow: 0px 3px 18px -1px rgba(21, 20, 19, 1);
  -moz-box-shadow: 0px 3px 18px -1px rgba(21, 20, 19, 1);
  box-shadow: 0px 3px 18px -1px rgba(21, 20, 19, 1);
}
<div id="headerbg">
  <div class="container">
    <div class="row">
      <div class="five columns">
        <img src="images/thv-header.png" id="header">
      </div>
      <div class="seven columns">
        <nav>
          <ul>
            <li><a href="#about">About</a>
            </li>
            <li><a href="#contact">Contact</a>
            </li>
            <li><a href="#designers">Designers</a>
            </li>
          </ul>
        </nav>
      </div>
    </div>
  </div>
</div>

关于css - 多重背景 : Semi-Transparent Color on a BG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31076764/

相关文章:

html - 通用选择器对性能有何影响?

html - 如何让我的导航栏 <LI> 元素 CSS 居中?

javascript - 当图像悬停在区域 <map> 上时

html - CSS 未按预期显示

iphone - uibarbuttonitem iOs 6 横向的自定义图像

CSS - 用黑色填充网页的其余部分

ios - 背景不会显示在 View Controller 上。愚蠢的问题?

javascript - 使用js函数调用JSF中的后台方法,并获取后台bean的返回值

ios - 如何模拟后台附件 iPad

android - 如何为与多个布局对象相关的背景图像支持不同的手机和屏幕尺寸