我有个问题:我制作了一个显示图片的幻灯片。现在我想在下面继续,把文本和其他东西放在页面上,但是如果我试图在下面插入一个文本,文本将不会写在幻灯片下面,而是在幻灯片下面。这是我希望你能帮我的代码。
div.slider {
display: flex;
width: 92%;
height: 750px;
margin-bottom: 20px;
margin-left: 4%;
margin-right: 4%;
margin-top: 20px;
background-color: #1f1f1f;
overflow: hidden;
position: absolute;
}
div.slider > * {
position: absolute;
display: flex;
widows: 100%;
height: 100%;
background: #1f1f1f;
animation: slide 12s infinite;
overflow: hidden;
}
div.slide:nth-child(1) {
left: 0%;
animation-delay: -1s;
background-image: url(https://wowslider.com/sliders/demo-7/data/images/amsterdam.jpg);
background-size: cover;
background-position: center;
}
div.slide:nth-child(2) {
left: 100%;
animation-delay: 2s;
background-image: url(https://wowslider.com/sliders/demo-7/data/images/barpark.jpg);
background-size: cover;
background-position: center;
}
div.slide:nth-child(3) {
left: 100%;
animation-delay: 5s;
background-image: url(https://wowslider.com/sliders/demo-7/data/images/florence.jpg);
background-size: cover;
background-position: center;
}
div.slide:nth-child(4) {
left: 100%;
animation-delay: 8s;
background-image: url(https://wowslider.com/sliders/demo-7/data/images/gate.jpg);
background-size: cover;
background-position: center;
}
div.slide p {
font-size: 70px;
text-align: center;
display: inline-block;
width: 100%;
margin-top: 340px;
color: #fff
}
@keyframes slide {
0% { left: 100%; width: 100%;}
5% { left: 0%;}
25% { left: 0%;}
30% { left: -100%; width: 100%;}
30.0001% { left: -100%; width: 0%;}
100% { left: 100%; width: 0%;}
}<html>
<body>
<div class="slider">
<div class="slide"><p>Slide1</p></div>
<div class="slide"><p>Slide2</p></div>
<div class="slide"><p>Slide3</p></div>
<div class="slide"><p>Slide4</p></div>
</div>
<div>
<p>Text that should appear under the slideshow.</p>
</div>
</body>
</html>
发布于 2020-02-15 11:41:12
将position of div.slider更改为relative
https://stackoverflow.com/questions/60238193
复制相似问题