案例中涉及了定位,清除浮动,居中方法等内容。配合position和margin就可以完成定位。
<div class="main clearfix">
<div class="left">
<img src="img/left-circle.png" height="30" width="30" alt="img"/>
</div>
<div class="right">
<img src="img/right-circle.png" height="30" width="30" alt="img"/>
</div>
<div class="dots">
<ul>
<li class="dot"></li>
<li class="dot"></li>
<li class="dot"></li>
<li class="dot"></li>
<li class="dot"></li>
</ul>
</div>
</div>
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
.main {
margin: 0 auto;
width: 1200px;
height: 360px;
background: url("img/s1.jpg") no-repeat;
position: relative;
}
.left {
position: absolute;
top: 50%;
left: 20px;
margin-top: -15px;
}
.right {
position: absolute;
top: 50%;
margin-top: -15px;
right: 20px;
}
.dots {
width: 110px;
height: 20px;
position: absolute;
bottom: 10px;
left: 50%;
margin-left: -55px;
}
li {
float: left;
width: 10px;
height: 10px;
background-color: #fff;
border-radius: 50%;
margin-left: 10px;
}
.clearfix:after {
content: '.';
display: block;
visibility: hidden;
clear: both;
}