大家好,所以我正在创建一个网站,在主页上,我想让3张图片相互淡入和淡出,我无法弄清楚我做错了什么。如果我按下,但是当我希望它们在一定时间后自己过渡时,图像会改变。这是我在CSS中的代码,感谢您的帮助。
@import url(http://fonts.googleapis.com/css?family=Varela+Round);
html, body { background: #333 url("http://codepen.io/images/classy_fabric.png"); }
.slides {
padding: 0;
width: 800px;
height: 534px;
display: block;
margin: 0 auto;
position: relative;
}
.slides * {
user-select: none;
-ms-user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
}
.slides input { display: none; }
.slide-container { display: block; }
.slide {
top: 0;
opacity: 0;
width: 800px;
height: 534px;
display: block;
position: absolute;
transform: scale(0s);
transition: all .7s fade;
}
.slide img {
width: 100%;
height: 100%;
}
/*---.nav label {
width: 200px;
height: 100%;
display: none;
position: absolute;
opacity: 0;
z-index: 9;
cursor: pointer;
transition: opacity 1s;
color: #FFF;
font-size: 175pt;
text-align: center;
line-height: 450px;
font-family: "Varela Round", sans-serif;
background-color: rgba(255, 255, 255, .3);
text-shadow: 0px 0px 15px rgb(119, 119, 119);
}
---*/
/*-- .slide:hover + .nav label { opacity: 0.5; } --*/
/*-- .nav label:hover { opacity: 1; } --*/
/*-- .nav .next { right: 0; } ---*/
input:checked + .slide-container .slide {
opacity: 1;
transform: scale(1);
transition: opacity 1s fade;
}
input:checked + .slide-container .nav label { display: none; }
.nav-dots {
width: 100%;
bottom: 9px;
height: 11px;
display: block;
position: absolute;
text-align: center;
}
.nav-dots .nav-dot {
top: -5px;
width: 11px;
height: 11px;
margin: 0 4px;
position: relative;
border-radius: 100%;
display: inline-block;
background-color: rgba(0, 0, 0, 0.6);
background: #C9C9C9;
}
.nav-dots .nav-dot:hover {
cursor: pointer;
background-color: rgba(0, 0, 0, 0.8);
background: #FFFFFF;
}
input#img-1:checked ~ .nav-dots label#img-dot-1,
input#img-2:checked ~ .nav-dots label#img-dot-2,
input#img-3:checked ~ .nav-dots label#img-dot-3,
{
background: rgba(0, 0, 0, 0.8);
}
.clearfix {
clear: both;
}