简单轮播图html代码
时间: 2023-12-25 07:30:15 浏览: 104
一个很简单的轮播图.html
以下是一个简单的轮播图的HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>简单轮播图</title>
<style>
.slider {
width: 500px;
height: 300px;
overflow: hidden;
}
.slider ul {
list-style-type: none;
margin: 0;
padding: 0;
width: 200%;
animation: slide 4s infinite;
}
.slider li {
float: left;
width: 50%;
}
.slider img {
width: 100%;
height: 100%;
}
@keyframes slide {
0% {margin-left: 0;}
20% {margin-left: 0;}
25% {margin-left: -100%;}
45% {margin-left: -100%;}
50% {margin-left: -200%;}
70% {margin-left: -200%;}
75% {margin-left: -100%;}
95% {margin-left: -100%;}
100% {margin-left: 0;}
}
</style>
</head>
<body>
<div class="slider">
<ul>
<li><img src="imgs/1.jpg" alt="#"></li>
<li><img src="imgs/2.jpg" alt="#"></li>
<li><img src="imgs/3.jpg" alt="#"></li>
</ul>
</div>
</body>
</html>
```
阅读全文