gpt4 book ai didi

html - 我的 css3 in position 标签有问题

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

我的下拉导航栏有问题,当我在 css 中定义位置时,下拉导航栏位于图像后面。我希望你理解我的问题。请帮助我,也很抱歉英语不好。

Here is a image showing the problem

.img-slider-ul {
list-style: none;
margin: 0;
padding: 0;
height:350px;
overflow:hidden;
position:relative;
}
.img-slider-li {
position:absolute;
}
.img-slider{
border: 1px solid #000;
border-radius: 3px;
box-shadow: 0 0 5px 0 hsla(0,0%,30%, .3);
height:350px;
}
.img-slider-li:nth-child(4) {
animation: xfade 16s 0s infinite;
}
.img-slider-li:nth-child(3) {
animation: xfade 16s 4s infinite;
}
.img-slider-li:nth-child(2) {
animation: xfade 16s 8s infinite;
}
.img-slider-li:nth-child(1) {
animation: xfade 16s 12s infinite;
}
@keyframes xfade{
17% {
opacity:1;
}
25% {
opacity:0;
}
92% {
opacity:0;
}
}
<ul class="img-slider-ul">
<li class="img-slider-li"><img class="img-slider" title="" alt="css3" src="https://image.ibb.co/dnt83v/img01.png" /></li>
<li class="img-slider-li"><img class="img-slider" title="" alt="css3" src="https://image.ibb.co/iJuFiv/img02.png" /></li>
<li class="img-slider-li"><img class="img-slider" title="" alt="css3" src="https://image.ibb.co/nf8VGF/img03.png" /></li>
<li class="img-slider-li"><img class="img-slider" title="" alt="css3" src="https://preview.ibb.co/hJZ4bF/img04.png" /></li>
</ul>

最佳答案

与 slider 部分相比,添加“下拉菜单”Z-index 应该较高

 .img-slider-ul {
list-style: none;
margin: 0;
padding: 0;
height:350px;
overflow:hidden;
position:relative;
z-index:99;
}

为下拉菜单类添加z-index:999;

关于html - 我的 css3 in position 标签有问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42809447/

27 4 0