web前端html中不用js用css中的动画实现轮播图效果
用到知识点主要是css中animation动画效果 1.animation属性简写如下
animation: name duration timing-function delay iteration-count direction fill-mode play-state;
2.关键帧的设置@keyframes name{ }
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>轮播图</title>
<style>
#bg {
width: 720px;
height: 360px;
background-image: url(1.jpg);
background-size: 100%;
position: relative;
animation: imgs 6s linear infinite;
}
@keyframes imgs {
0%,
30% {
background-image: url(2.jpg);
}
31%,
60% {
background-image: url(3.jpg);
}
61%,
100% {
background-image: url(1.jpg);
}
}
</style>
</head>
<body>
<div id="bg">
</div>
</body>
</html>
效果如下不知道为啥不能放视频就先放个图片,下面的连接时视频效果 视频效果比较小不到1M也是免费的想看可以一下载一下 https://download.csdn.net/download/weixin_46097122/82505459
|