CSS background-size 属性动画

cssweb developmentfront end technology更新于 2024/10/14 7:08:17

要使用 CSS 实现 background-size 属性动画,您可以尝试运行以下代码:

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 500px;
            height: 400px;
            background: yellow;
            background-image: url('https://www.cainiaomax.com/latest/microservice_architecture.png');
            animation: myanim 3s infinite;
            background-position: bottom left;
            background-size: 50px;
         }
         @keyframes myanim {
            20% {
               background-color: maroon;
               background-position: bottom right;
               background-size: 90px;
            }
        }
      </style>
   </head>
   <body>
      <div></div>
   </body>
</html>

相关文章


有用资源