html - 透明背景和标志

标签 html css

我想将 Logo 放在透明的黑色背景中,但我的 Logo 现在变得透明......这是一个问题。 我希望我的 Logo 与以前一样。

请问你有什么想法吗?

enter image description here

这是我的 HTML

<div class="my-banner">
    <img class="banner" src="images/slider.jpg" alt="banniere">
    <div class="background-opacity">
      <img class="logo" src="images/logo.png" alt="logo" >
    </div>
  </div>

我的CSS

.banner{
  height: 530px;
  width: 1366px;
  position: absolute;
}

.background-opacity{
  background-color: black;
  opacity: 0.5; 
  height: 100px;
  width: 1366px;
}

.logo{
  padding: 20px 0px 0px 35px;
}

最佳答案

使用以下内容:

.background-opacity{
  background-color: rgba(0,0,0,0.5);
  opacity: 1; 
  height: 100px;
  width: 1366px;
}

关于html - 透明背景和标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53783406/

相关文章:

javascript - 动态添加代码后单击事件不起作用

html - 多行缩进文本之前的CSS背景图像

css - 多个 z-index 元素

html - Chrome 可滚动 Div 错误

jquery - epagex 和 offset 的问题

javascript - 如何使用 DIV 作为节点编写简单的 d3.js 网络图

html - Google map 未显示在 "row"类中

html - 我怎样才能复制两个 :before in css?

html - 为什么我的文本溢出 : ellipsis; did't work?

c# - 将图像放在 HTML 5 中的 div 中