CSS3实现环状Loading动画

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .vant-loading {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      background-color: rgba(0, 0, 0, 0.5);
      /* 半透明背景,可根据需要调整透明度 */
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 9999;
      /* 使加载动画置于页面最顶层 */
    }

    .vant-loading-spinner {
      border: 4px solid #ccc;
      border-top: 4px solid #007aff;
      /* 加载动画的颜色,可以根据需要调整 */
      border-radius: 50%;
      width: 40px;
      height: 40px;
      animation: spin 1s linear infinite;
      /* 使用 CSS 动画实现旋转效果 */
    }

    @keyframes spin {
      0% {
        transform: rotate(0deg);
      }

      100% {
        transform: rotate(360deg);
      }
    }

  </style>
</head>

<body>
  <div class="vant-loading">
    <div class="vant-loading-spinner"></div>
  </div>

</body>

</html>

猜你喜欢

转载自blog.csdn.net/u011690675/article/details/133312592
今日推荐