-5
我無法將我的圖像填充到單個div,堆滿了所有圖像。這似乎是他們放置在一個行在div中存檔圖像堆棧
@keyframes fade {
0% {
opacity: 0;
}
11.11% {
opacity: 1;
}
33.33% {
opacity: 1;
}
44.44% {
opacity: 0;
}
100% {
opacity: 0;
}
}
.fadein {
position: absolute;
height: 200px;
width: 400px;
display: inline-block;
background-size: contain;
overflow: hidden;
border: 4px solid #2e7645;
background-size: cover;
background-position: center;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
/** outline: 1px solid blue; **/
}
.fadein img {
max-width: 100%;
max-height: 100%;
z-index: -1;
position: relative;
left: 0;
right: 0;
opacity: 0;
animation-name: fade;
animation-duration: 9s;
animation-iteration-count: infinite;
}
.fadein img:nth-child(1) {
animation-delay: 0s;
}
.fadein img:nth-child(2) {
animation-delay: 3s;
}
.fadein img:nth-child(3) {
animation-delay: 6s;
}
<div class="fadein">
<img src="http://via.placeholder.com/350x150" style="width:100%">
<img src="http://lorempixel.com/output/animals-q-c-350-150-1.jpg" style="width:100%">
<img src="http://lorempixel.com/output/technics-q-c-350-150-2.jpg" style="width:100%">
</div>
Link我的小提琴