幻灯片边框不必要的填充

时间:2019-12-28 13:19:35

标签: javascript html css

我在网站上使用了slider,但是一旦在网站上实现了此功能,滑块边框就会无缘无故地出现,并且滑块箭头按钮会消失。

enter image description here

这是我的滑块CSS代码:

/* Slideshow */
#slideshow {
    margin: -200px auto;
    position: relative;
    width: 100%;
    padding: 1% 1% 56.25% 1%; /*56.25 is for 16x9 resolution*/
        border-radius:20px;
        background: rgba(0,0,0,0.2);
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
  box-sizing:border-box;
}

#slideshow > div {
    position: absolute;
}

#slideshow > div > img {
    width: 100%;
    height: 50vh;
    border-radius:20px;
}

#slideshow:hover i, #slideshow:hover .slider-dots{
    opacity: 1;
    }

.slidebtn {
    z-index: 99;
    background:transparent;
    outline:none;
    border:none;
    -webkit-transition: all 0.3s;
    -moz-transition: all 0.3s;
    transition: all 0.3s;
    padding:0 10px 0 10px;
    }

.slidebtn:active,
.slidedtn:focus {
    outline:none;
}

.slidebtn i {
    color:#FFF;
    font-size:72px;
    opacity: 0.2;
    -webkit-transition: all 0.3s;
    -moz-transition: all 0.3s;
    transition: all 0.3s;

    }

.prev {
    position: absolute;
    top: 10px;
    left: 10px;
    bottom: 10px;
}

.next {
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: 10px;
}


.slider-dots {
    opacity: 0.2;
  list-style: none;
  display: inline-block;
  padding-left: 0;
  margin-bottom: 0;
  position:absolute;
  left:50%;
  bottom:3%;
  transform: translate(-50%, 0);
  z-index:99;
  -webkit-transition: all 0.3s;
    -moz-transition: all 0.3s;
    transition: all 0.3s;

}

.slider-dots li {
  color: #000;
  display: inline;
  font-size: 48px;
  margin-right: 5px;
  cursor:pointer;
}

.slider-dots li.active-dot {
  color: #fff;
}

我想使滑块按钮可见,并且边框停止填充到底部,但是我不知道为什么元素向下填充并消失,我遍历了代码多次。

如何使滑块按钮可见并阻止滑块向下滑动?

Codepen

1 个答案:

答案 0 :(得分:1)

原始链接具有

#slideshow > div {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
}

而您的CSS只有

#slideshow > div {
    position: absolute;
}