css代码
#intro {
position: relative;
background-attachment: fixed;
background-repeat: no-repeat;
background-position: center top;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
text-align: center;
padding-top: 15.6rem;
overflow: hidden;
}
#intro > figure {
animation: imageAnimation 30s linear infinite 0s;
backface-visibility: hidden;
background-size: cover;
background-position: center center;
color: transparent;
height: 100%;
left: 0px;
opacity: 0;
position: absolute;
top: 0px;
width: 100%;
z-index: 0;
margin-left: 0px;
}
#intro > figure:nth-child(1){
background-image: url('../images/1.jpg');
}
#intro > figure:nth-child(2){
animation-delay: 6s;
background-image: url('../images/2.jpg');
}
#intro > figure:nth-child(3){
animation-delay: 12s;
background-image: url('../images/3.jpg');
}
html代码:
<section id="intro">
<figure></figure>
<figure></figure>
<figure></figure>
</section>
在这段代码中,我将逐一显示背景图像,但是当背景图像在第三张图像之后逐渐淡出时,它显示黑色背景。那么,如何删除黑色背景我想用css只显示图像。
谢谢