奔跑的马儿

272 阅读1分钟
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    
    <style>
      * {
        margin: 0;
        padding: 0;
      }

      @keyframes run {
        0% {
          background-position: 0 0;
        }
        100% {
          background-position: -2400px 0;
        }
      }

      div {
        width: 200px;
        height: 100px;
        background-image: url(horse.png);
        background-repeat: no-repeat;
        background-position: 0 0;
        animation: run 0.5s steps(12, end) infinite;
      }
    </style>
  </head>
  <body>
    <div class="horse"></div>
  </body>
</html>