如果我使用没有位置绝对值且右上角右下角0的叠加层,接下来会出现什么问题?

问题描述

如果我使用覆盖层,接下来会出现什么问题 没有position absolutetop left right bottom; 0吗?

<div class="home">                                                       
  <div class="overlay"></div>
</div>
.home {
  background: url(../imgs/background/background1.webp) ;
  background-size:cover ;
  width: 100vw;
  height: 100vh;
  position: relative;
}
.overlay {
  background-color: rgba (0,0.7);
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

我刚刚使用

.overlay {
  background: rgba (0,0.7);
  width: 100%;
  height: 100%;
}

image here

现在可以获得相同的结果。

来源。 W3schools How TO - Overlay

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)