其他分享
首页 > 其他分享> > css画八卦图

css画八卦图

作者:互联网

<!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>八卦图</title>
  <style>
    .container {
      width: 401px;
      height: 401px;
      border-radius: 50%;
      box-sizing: border-box;
      border: 1px solid #000;
      display: flex;
      overflow: hidden;
      animation: rotating 4s linear infinite;
    }
    @keyframes rotating {
      0% {
        transform: rotate(0deg);
      }
      100% {
        transform: rotate(360deg);
      }
    }
    /* 白色背景那部分样式 */
    .white-wrap {
      width: 50%;
      height: 100%;
      background-color: #fff;
      position: relative;
    }
    .black-circle {
      width: 100%;
      height: 50%;
      border-radius: 50%;
      background-color: #000;
      position: absolute;
      bottom: 0;
      right: -50%;
    }
    .mini-white-circle {
      width: 30%;
      height: 30%;
      border-radius: 50%;
      background-color: #fff;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      z-index: 9;
    }

    /* 黑色背景那部分样式 */
    .black-wrap {
      width: 50%;
      height: 100%;
      background-color: #000;
      position: relative;
    }
    .white-circle {
      width: 100%;
      height: 50%;
      border-radius: 50%;
      background-color: #fff;
      position: absolute;
      top: 0;
      left: -50%;
    }
    .mini-black-circle {
      width: 30%;
      height: 30%;
      border-radius: 50%;
      background-color: #000;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      z-index: 9;
    }
    
  </style>
</head>
<body>
  
  <div class="container">
    <div class="white-wrap">
      <div class="black-circle">
        <div class="mini-white-circle"></div>
      </div>
    </div>
    <div class="black-wrap">
      <div class="white-circle">
        <div class="mini-black-circle"></div>
      </div>
    </div>
  </div>

</body>
</html>

 

标签:八卦图,50%,height,width,color,background,border,css
来源: https://blog.csdn.net/c2635222586/article/details/113827769