代码👇
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>淘宝轮播图</title>
<style>
*{
margin:0px;
padding:0px;
}
.tb-promo {
position:relative;
margin: 100px auto;
width: 360px;
height: 360px;
}
.tb-promo img{
width:360px;
height:360px;
}
.prev{
position:absolute;
left:0;
top:50%;
margin-top:-15px;
width:20px;
height:20px;
background-color:rgba(0,0,0,0.3);
text-align:center;
color:white;
line-height:20px;
text-decoration:none;
border-top-right-radius:15px;
border-bottom-right-radius:15px;
}
.aft {
position: absolute;
right: 0;
top: 50%;
margin-top:-15px;
width: 20px;
height: 20px;
background-color: rgba(0,0,0,0.3);
text-align: center;
color: white;
line-height: 20px;
text-decoration: none;
border-top-left-radius: 15px;
border-bottom-left-radius: 15px;
}
.promo-nav {
position: absolute;
bottom: 15px;
left: 50%;/*这个属性是根据position来的,让这个框居中对齐*/
/*让他在往左偏一点,居中对齐*/ margin-left: -35px;
width: 70px;
height: 13px;
background: rgba(0,0,0,0.5);
border-radius: 5px;
}
.promo-nav li{
float:left;
width:8px;
height:8px;
background-color:white;
border-radius:50%;
margin:3px;
}
/*不要忘记权重问题*/
.promo-nav .selecetd {
background-color: red;
}
</style>
</head>
<body>
<div class="tb-promo">
<img src=" https://img.alicdn.com/img/i4/54637139/O1CN01baCcOe22biRppXtSs_!!0-saturn_solar.jpg_360x360xzq75.jpg_.webp" alt="" />
<div class="prev " href="#"><</div>
<div class="aft " href="#">></div>
<ul class="promo-nav">
<li class="selecetd"></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>
实现效果