如何用html+css写出这样的按钮?

如何用html+css写出这样的按钮?
image.png

阅读 1.6k
2 个回答
<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    .container {
      width: 100%;
      height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: #e2e2e2;
    }

    .container .loading {
      width: 200px;
      height: 100px;
      border-radius: 20px;
      overflow: hidden;
      background-color: #ffffff;
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .container .loading .loading-mask {
      width: 400px;
      height: 400px;
      position: absolute;
      left: -50%;
      top: 50%;
      z-index: 1;
      border-radius: 40%;
      background-color: rgba(0, 191, 255, 0.8);
      animation: rotato 20s linear 0s infinite;
      transition: all 1s;
    }

    /* .container .loading .loading-mask::after {
      content: "";
      display: block;
      width: 100%;
      height: 100%;
      position: absolute;
      left: 0;
      top: 0;
      z-index: 1;
      border-radius: 36%;
      overflow: hidden;
      animation: rotato 11s linear 0s infinite;
      background-color: rgba(0, 191, 255, 0.6);
      transform: rotate(0deg);
    } */

    .container .loading .loading-mask::before {
      content: "";
      display: block;
      width: 100%;
      height: 100%;
      position: absolute;
      left: 0;
      top: 0;
      z-index: 2;
      border-radius: 30%;
      overflow: hidden;
      animation: rotato 20s linear 0s infinite;
      background-color: rgba(0, 191, 255, 0.4);
      transform: rotate(45deg);
    }

    .container .loading .loading-text {
      position: relative;
      z-index: 9;
      font-size: 50px;
      color: #f2f2f2;
    }


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

      100% {
        transform: rotate(360deg);
      }
    }
  </style>

<body>
  <div class="container">
    <div class="loading">
      <div id="loadingMask" class="loading-mask"></div>
      <div id="loading" class="loading-text">anniu</div>
    </div>
  </div>

</body>

</html>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题