gpt4 book ai didi

html - 较高 Z-Index 上的元素受较低 Z-Index 上透明 Div 的影响

转载 作者:行者123 更新时间:2023-11-28 02:07:43 27 4
gpt4 key购买 nike

我有一个非常简单的网页设置,由 div、标题和 i 元素组成的网格:

Before background div

我想要做的就是在这个网格后面添加一个带有背景颜色和标题的 div,网格的元素出现在新背景 div 的顶部。

但是,当我尝试这样做时,我得到了:

After new div

如您所见,背景 div 的透明颜色与按钮重叠,仅在网格中。

我已确定调整所有元素(背景 div、网格及其所有元素)的 z-index,以便它们确实具有比背景 div 更高的 z-index 值。

这是我的 HTML 和 CSS:

HTML

<html>
...
<body>
<div id="sfa3features"><h1>New SFA3 Features!</h1></div>
...
<div class="wrapper-how-to" id="grid-menu3">

<div class="row-top"></div>
<h2 class="row-top label-cell">Setting</h2>
<div class="row-top"></div>
<div class="row-top"></div>
<div class="row-top"></div>
<div class="row-top"></div>

<i class="image-cell fa fa-info-circle fa-2x"></i>
<h3 class="label-cell">Combo Items</h3>

<div id="combo_items_finding" class="box-how-to enabled"><h3>Finding</h3> <span class="popup popup-how-to" id="popup_combo_items_finding" > </div>
<div id="combo_items_updating" class="box-how-to impossible"><h3>Updating</h3> <span class="popup popup-how-to" id="popup_combo_items_updating" ></div>
<div id="combo_items_entering" class="box-how-to enabled"><h3>Entering</h3> <span class="popup popup-how-to" id="popup_combo_items_entering" ></div>
<div id="combo_items_linking" class="box-how-to impossible"><h3>Linking</h3><span class="popup popup-how-to" id="popup_combo_items_linking" ></div>

</div>

<div class="wrapper-how-to" id="grid-menu4">

<div class="row-top"></div>
<h2 class="row-top label-cell">Pickbox</h2>
<div class="row-top"></div>
<div class="row-top"></div>
<div class="row-top"></div>
<div class="row-top"></div>

<i class="image-cell fa fa-folder-o fa-2x"></i>
<h3 class="label-cell">Pickbox</h3>

<div id="pickbox_finding" class="box-how-to enabled"><h3>Finding</h3> <span class="popup popup-how-to" id="popup_pickbox_finding" > </div>
<div id="pickbox_updating" class="box-how-to enabled"><h3>Updating</h3> <span class="popup popup-how-to" id="popup_pickbox_updating" ></div>
<div id="pickbox_entering" class="box-how-to enabled"><h3>Entering</h3> <span class="popup popup-how-to" id="popup_pickbox_entering" ></div>
<div id="pickbox_linking" class="box-how-to impossible"><h3>Linking</h3><span class="popup popup-how-to" id="popup_pickbox_linking" ></div>

</div>

...
</body>
</html>

CSS

.wrapper-how-to {

display: grid;

grid-gap: 10px;
grid-template-columns: 5% 22% 16% 16% 16% 16%;

background-color: transparent;
color: #444;
margin: 2.5% auto !important;
}

.wrapper-how-to h2,
.wrapper-how-to h3,
.wrapper-how-to div,
.wrapper-how-to i
{
z-index:2;
}


#sfa3features{
/*Should be the same as coverup5, but back layer*/

display: flex;

position: absolute;
width: 105%;
left:-4%;
align-items: flex-start;
justify-content: center;

background-color: rgba(255, 219, 89,0.8);
border-color: rgb(252, 204, 30);
border-style: solid;
border-radius: 8px;
border-width: 5px;

z-index: -1;

height: 400px;
top:1485px;
}

知道发生了什么吗?

最佳答案

我有点糊涂了。 div 元素具有透明颜色。当然他们也会使用背景 div 的颜色。

将 CSS 切换为不透明颜色应该可以解决问题。

关于html - 较高 Z-Index 上的元素受较低 Z-Index 上透明 Div 的影响,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48933709/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com