css - 设置后背景颜色不可见

标签 css

想要将 background-color 应用于嵌套在 footer 中的 divfooter 有一个 background-image 覆盖了我在 CSS 中设置的整个页脚。包含 imgdivbackground-color 应该到达 footer 的底部bakground-img。这是我的意思的一个例子:

enter image description here

我的代码是这样的:

  <footer>
    <div class="some class">
      <img src="img/some-image.png" alt=" ">
      <div class="some class"> other content </div>
    </div>
    <div class="bottom-footer">  </div>
  </footer>

CSS:

footer {
  background-image: url('../img/footer.jpg');
  background-repeat: no-repeat;
  background-size: 100%;
  height: 400px;
  width: 100%;
}

.some.class {
  width: 300px;
  height: 365px;
  margin-left: 2%;
  background-color: (0,0,0,.97);
  z-index: 1;
}
 div.some img {
  width: 260px;
  height: 130px;
  margin-top: 30px;
 }

显示了 img,但我看不到具有 img 的 div 的 background-color。可能是一个简单的修复,但我似乎无法弄清楚。任何帮助将不胜感激。

最佳答案

您需要包含 rgba

background-color: rgba(0,0,0,.97);

关于css - 设置后背景颜色不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34094499/

相关文章:

html - 用于选择至少包含一个 UL 的 DIV 的 CSS 选择器(或 JavaScript,如果需要)

css - 上边距在 IE 8 中不起作用

javascript - 添加列表元素后将css应用于listview

css - 从网格容器中推/拉元素

Javascript 按钮,防止鼠标双击

php - 编辑模板 Bootstrap 以在行中显示 4 个产品图像

html - iPhone 禁用左右滑动来移动页面

javascript - 粘性 'back to top' 按钮在 iMac Firefox 中有效,但在 Safari、Chrome 或 Android 手机中无效

javascript - 我在 javascript 和 html 中有一个 true 或 false 变量的错误

html - 悬停时列表项背景颜色改变