gpt4 book ai didi

javascript - 已设置位置,但 z-index 无效

转载 作者:太空宇宙 更新时间:2023-11-03 22:23:54 29 4
gpt4 key购买 nike

我想创建一个步骤进度条,但我的 CSS 有问题。
我想让圆圈被线覆盖,但是不行。
演示如下:

HTML:

ol {
display: table;
table-layout: fixed;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
}

li {
position: relative;
display: table-cell;
text-align: center;
}

li:after {
content: "";
position: relative;
z-index: 1000;
display: block;
width: 2em;
height: 2em;
margin: 0 auto;
line-height: 2em;
color: #fff;
border: 0.2em #e1e1e1 solid;
border-radius: 100%;
}

li:not(:last-child):before {
content: "";
position: absolute;
top: 50%;
left: 50%;
z-index: -1;
display: block;
width: 100%;
height: 0.2em;
background-color: #e1e1e1;
}
<ol>
<li>
Order received
</li>
<li>
Order received
</li>
<li>
Order received
</li>
<li>
Order received
</li>
<li>
Order received
</li>
</ol>

codepen

最佳答案

如果我理解正确的话,你只需在 &:after 选择器上设置 background-color 而不是 color

&:after {
background-color: #fff;
}

关于javascript - 已设置位置,但 z-index 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52383630/

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