<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<link rel="stylesheet" href="./iconfont/iconfont.css">
</head>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
li{
list-style: none;
}
.banner{
width: 564px;
height: 315px;
margin: 100px auto;
overflow: hidden;
position: relative;
}
.banner img{
width: 564px;
border-radius: 12px;
vertical-align: middle;
}
.banner ul{
display: flex
}
.banner .left{
width: 20px;
height: 30px;
position: absolute;
top: 50%;
transform: translateY(-50%);
background-color: rgba(0, 0, 0, 0.3);
border-radius: 0 15px 15px 0;
text-decoration: none;
color: #fff;
line-height: 30px;
display: none;
cursor: pointer;
}
.banner .right{
width: 20px;
height: 30px;
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 0;
background-color: rgba(0, 0, 0, 0.3);
border-radius: 15px 0 0 15px;
text-decoration: none;
color: #fff;
line-height: 30px;
text-align: center;
display: none;
cursor: pointer;
}
.banner:hover .left,
.banner:hover .right{
display: block;
}
.banner ol{
position: absolute;
background-color: rgba(255, 255, 255, 0.3);
height: 13px;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
display: flex;
border-radius: 10px;
}
.banner ol li{
margin: 3px;
width: 8px;
height: 8px;
background-color: #fff;
border-radius: 50%;
cursor: pointer;
}
</style>
<body>
<div class="banner">
<ul>
<li><a href=""><img src="./1.png" alt=""></a></li>
<li><a href=""><img src="./2.png" alt=""></a></li>
<li><a href=""><img src="./3.png" alt=""></a></li>
</ul>
<div class="left">
<span class="iconfont icon-arrow-left-bold"></span>
</div>
<div class="right">
<span class="iconfont icon-arrow-right-bold"></span>
</div>
<ol>
<li></li>
<li></li>
<li></li>
</ol>
</div>
</body>
</html>
HTML+CSS练习轮播图静态布局
于 2024-05-04 16:37:37 首次发布