<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
list-style-type: none;
}
.tb-promo {
position: relative;
width: 520px;
height: 280px;
background-color: pink;
margin: 100px auto
}
.tb-promo img {
width: 520px;
height: 280px;
}
/* 并集选择器 */
.prev a,
.next a {
/* 实现绝对定位需要父盒子相对定位 */
position: absolute;
top: 50%;
margin-top: -15px;
width: 20px;
height: 30px;
color: white;
/* 实现文本水平居中,需要是标准流 */
text-align: center;
/* 设置背景颜色 */
background: rgba(0, 0, 0, 0.3);
/* 去除a标签下自带的下划线 */
text-decoration: none;
}
/* 左侧按钮 */
.prev a {
left: 0;
/* 实现将指定的角进行圆角处理 */
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
}
/* 右侧按钮 */
.next a {
right: 0;
border-top-left-radius: 15px;
border-bottom-left-radius: 15px;
}
/* 实现轮播图的焦点图 */
.promo-nav {
position: absolute;
/* 设置与底部的距离 */
bottom: 15px;
/* 设置居中定位 */
left: 50%;
margin-left: -35px;
/* background-color: pink; */
width: 70px;
height: 13px;
/* 设置背景颜色 */
background: rgba(255, 255, 255, .3);
/* 设置圆角 */
border-radius: 7px;
}
/* 实现小圆点 */
.promo-nav li {
float: left;
width: 8px;
height: 8px;
background-color: #fff;
border-radius: 50%;
margin: 3px;
}
.promo-nav li.class1 {
background-color: orange;
}
</style>
</head>
<body>
<div class="tb-promo">
<img src="https://img.alicdn.com/imgextra/i2/6000000008044/O1CN01WNa4ET29ICaDtz9io_!!6000000008044-0-octopus.jpg"
alt="">
<!-- 左侧箭头 -->
<div class="prev">
<a href="#"><</a>
</div>
<!-- 右侧箭头 -->
<div class="next">
<a href="#">></a>
</div>
<!-- 小圆点 -->
<ul class="promo-nav">
<li class="class1"></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>
淘宝轮播图
最新推荐文章于 2023-07-29 19:04:37 发布