发布时间:2022-11-21 13:30
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>淘宝焦点图</title>
<style>
* {
padding: 0%;
}
.tb-promo {
position: relative;
width: 564px;
height: 315px;
margin: 100px auto;
}
.tb-promo img {
width: 100%;
border-radius: 12px;
}
li {
list-style: none;
}
a {
position: absolute;
width: 20px;
height: 30px;
background: rgba(0, 0, 0, .3);
text-align: center;
line-height: 30px;
/* 加了绝对定位a会变成块元素,可以直接设置宽度和高度 */
text-decoration: none;
color: #fff;
}
.prev {
bottom: 0;
top: 0;
left: 0;
margin: auto 0;
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
}
.next {
bottom: 0;
top: 0;
right: 0;
margin: auto 0;
border-top-left-radius: 15px;
border-bottom-left-radius: 15px;
}
.promo-nav {
position: absolute;
bottom: 15px;
left: 0;
right: 0;
margin: 0 auto;
width: 70px;
height: 13px;
background: rgba(0, 0, 0, .3);
border-radius: 6px;
}
.promo-nav li {
float: left;
width: 8px;
height: 8px;
border-radius: 50%;
background-color: skyblue;
margin: 3px 3px;
}
.promo-nav .selected {
/* 覆盖.promo-nav li 中的颜色要注意权重大小,权重不够,不能覆盖 */
background-color: orange;
}
</style>
</head>
<body>
<div class="tb-promo">
<img src="img/focus.jpg" alt="">
<!-- 左侧箭头 -->
<a href="#" class="prev"><</a>
<!-- 右侧箭头 -->
<a href="#" class="next">></a>
<!-- 小圆点 -->
<ul class="promo-nav">
<li class="selected"></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>