day02(2017.9.21)
2017-09-21 本文已影响18人
晴_eeca
轮播图
//html
<div class="box">
<a href="#" class="one">1</a>
<a href="#" class="two">2</a>
<a href="#" class="three">3</a>
<div class="move">
<div class="list1"></div>
<div class="list2"></div>
<div class="list3"></div>
</div>
</div>
//css
.box{
width: 600px;
height: 400px;
margin: 100px auto;
overflow: hidden;
position: relative;
}
.move{
width: 1800px;
position: absolute;
}
.move>div{
width: 600px;
height: 400px;
float: left;
background-size: 600px 400px;
}
.list1{
background: url("images/01.jpg") no-repeat center;
}
.list2{
background: url("images/02.jpg") no-repeat center;
}
.list3{
background: url("images/03.jpg") no-repeat center;
}
a{
display: inline-block;
width: 50px;
line-height: 50px;
text-align: center;
font-size: 16px;
color: white;
text-decoration: none;
border: 1px solid #ccc;
border-radius: 50%;
margin: 10px auto;
cursor: pointer;
}
.one{
background: red;
}
.two{
background: green;
}
.three{
background: blue;
}
.one:focus +.two+.three+.move{
left: 0;
}
.two:focus+.three+.move{
left: -600px;
}
.three:focus+.move{
left: -1200px;
}
重要程序
.one:focus +.two+.three+.move{
left: 0;
}
.two:focus+.three+.move{
left: -600px;
}
.three:focus+.move{
left: -1200px;
}