分析:
1. 大盒子我们类名为:tb-promo 淘宝广告;
2. 里面先放一张图片;
3. 左右两个按钮用键接,左箭头用prev 右箭头用next;
4. 底侧小圆点用ul做,类名为promo-nav
<!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>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
.tb-promo {
position: relative;
/* position: relative;孩子有绝对定位,父亲要设置成相对定位,子绝父相 */
width: 1080px;
height: 720px;
margin: 30px auto;
}
.tb-promo img {
width: 1080px;
height: 720px;
}
.tb-promo a {
text-decoration: none;
}
.prev,
.next {
position: absolute;
/* position: absolute;加了绝对定位的盒子可以直接设置宽度和高度,会覆盖其他元素*/
/* 绝对定位的盒子垂直居中: */
top: 50%;
margin-top: -15px;
width: 25px;
height: 40px;
background: rgb(0, 0, 0, 0.4);
text-align: center;
line-height: 40px;
color: white;
}
.prev {
left: 0;
/* 设置圆角: */
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
}
.next {
right: 0;
/* 设置圆角: */
border-top-left-radius: 15px;
border-bottom-left-radius: 15px;
}
.promo-nav {
position: absolute;
bottom: 15px;
/* 水平居中效果等同于 left: 505px; */
left: 50%;
margin-left: -35px;
width: 70px;
height: 13px;
background-color: rgb(255, 255, 255, 0.4);
border-radius: 7px;
/* border-radius: 7px;将圆角设置为高度的一半 */
}
.promo-nav li {
float: left;
width: 8px;
height: 8px;
background-color: white;
border-radius: 50%;
margin: 3px;
}
/* 权重高的会重叠权重低的的样式,类选择器权重为10,标签权重为1 */
.promo-nav .selected {
background-color: gray;
}
</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 class="selected"></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<!-- 小圆点结束 -->
</div>
</body>
</html>