将背景设置为具有 16% 不透明度的 div

莱蒂

所以我想添加一个不透明度为 16% 的背景,它实际上可以工作现在看起来像 我想要的样子

当前代码:

#main-top {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  flex-wrap: wrap;
  margin-bottom: 1em;
  padding-bottom: 4em;
  text-align: center;
  clip-path: polygon(50% 0%, 100% 0, 100% 65%, 50% 100%, 0 65%, 0 0) !important;
  /*background-color: rgba(37, 170, 231, 0.904);*/
  background-color: var(--primary-color);
}
<div id="main-top">
  <div id="sosa">
    <h2>Birds</h2>

  </div>

用户3733831

你可以这样做:

#main-top {
  display: flex;
  justify-content: center;

  align-items: center;
  flex-direction: column;
  flex-wrap: wrap;
  margin-bottom: 1em;
  padding-bottom: 4em;

  text-align: center;
  clip-path: polygon(50% 0%, 100% 0, 100% 65%, 50% 100%, 0 65%, 0 0) !important;
  /*background-color: rgba(37, 170, 231, 0.904);*/
  background-color: blue;
  position: relative;
}

#main-top::after {
    position: absolute;
    content: '';
    background: url(https://placekitten.com/640/560) no-repeat center center;
    background-size: cover;
    width: 100%;
    height: 100%;
    z-index: 99;
    opacity: 0.4;
    top: 0;
}
<div id="main-top">
    <div id="sosa">
      <h2>Birds</h2>
  </div>
</div>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

div内的背景不透明度div

如何使用CSS为div的背景图像设置不透明度或降低亮度

设置具有不透明度的视差滚动 div

可以为DIV的背景色不透明度设置动画吗?

使用javascript将不透明度设置为子div

用纯色div覆盖文本(具有CSS不透明度)

设置div时如何赋予div不透明度Overflow = visible

使不透明度为0的div没有物理尺寸

使用伪元素:: before在Div中显示低不透明度背景图像

添加新 div 时背景图像不透明度增加

如何使用jQuery切换div的背景色不透明度?

创建后立即设置动态创建的div的不透明度

在contenteditable div中通过用户输入设置元素不透明度

CSS关键帧+不透明度:0完成后将div带回

无法将<div>居中对齐,并且无法正确管理不透明度

IE8-带有不透明度的div中的圆角

覆盖div的不透明度

CSS背景不透明度

设置TextView的不透明度

设置AVPlayerLayer的不透明度

在不影响IE 8中包含元素的情况下,div背景的不透明度?

如何仅在背景图像上而不在内部文本上应用div不透明度

调整 UIView 内按钮的不透明度,不透明度为 0.5

将带有叠加层的 div 中的文本置于前面,以便不透明度不会影响文本颜色?

如何使用Magick ++将具有透明背景的png图像设置为不透明度

在div上更改跨度的不透明度:悬停

切换div onclick的不透明度

jQuery单击时更改div的不透明度

div中的不同不透明度元素