- css的样式
* { margin: 0; padding: 0; } .box { width: 400px; height: 150px; margin: auto; overflow: hidden; border: 3px solid black; } .box:hover ul{ animation-play-state: paused; } ul { width: 1000px; height: 150px; animation: move 4s steps(3); list-style-type: none; } li { float: left; width: 200px; height: 150px; } img { width: 200px; height: 150px; } @keyframes move { to { transform: translate(-600px); } }
-
html结构
<div class="box"> <ul> <li> <a href=""> <img src="./images/1.jpg" alt=""> </a> </li> <li> <a href=""> <img src="./images/2.jpg" alt=""> </a> </li> <li> <a href=""> <img src="./images/3.jpg" alt=""> </a> </li> <li> <a href=""> <img src="./images/1.jpg" alt=""> </a> </li> <li> <a href=""> <img src="./images/2.jpg" alt=""> </a> </li> </ul> </div>
使用transform实现播轮图的效果
于 2022-05-12 22:01:39 首次发布