效果图如下:
代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>淘宝焦点图</title>
<style>
* {
margin: 0;
padding: 0;
}
.tb-promo {
position: relative;
height: 280px;
width: 520px;
margin: 100px auto;
}
.tb-promo img {
height: 280px;
width: 520px;
}
.prev,
.next {
position: absolute;
top: 50%;
margin-top: -15px;
width: 20px;
height: 30px;
background: rgba(0, 0, 0, 0.3);
text-decoration: none;
line-height: 30px;
color: #fff;
}
.tb-promo .prev {
left: 0;
border-radius: 0 15px 15px 0;
}
.tb-promo .next {
right: 0;
text-align: right;
border-radius: 15px 0 0 15px;
}
.promo-nav {
position: absolute;
bottom: 15px;
left: 50%;
margin-left: -35px;
width: 70px;
height: 14px;
background: rgba(255, 255, 255, 0.3);
border-radius: 7px;
}
.promo-nav li {
width: 8px;
height: 8px;
background-color: #fff;
list-style: none;
float: left;
border-radius: 50%;
margin: 3px;
}
.promo-nav li:hover {
background-color: #ff5000;
}
</style>
</head>
<body>
<div class="tb-promo">
<img src="images/tb.jpg" alt="">
<!-- 左侧按钮箭头 -->
<!-- <是小于号 -->
<a href="#" class="prev"><</a>
<!-- 右侧按钮箭头 -->
<!-- >是大于号 -->
<a href="#" class="next">></a>
<!-- 小圆点 -->
<ul class="promo-nav">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>