太极旋转简单实现

第一次写博客 操作一脸懵逼

第二次写这玩意, 第一次写的时候用的拼接法, 繁琐且累赘.

直接上图 :
上图先

!-- 思路 :
1 大盒子对半线性渐变 实现黑白半圆
2 中圆及小圆都用伪元素
3 给小圆宽高 中圆用小圆的 border值 实现
4 flex 主轴为 x轴 元素会排列在一行上 垂直居中压住

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Documenst</title>
    
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        body {
            background-color: #333;
        }
        div {
            display: flex;
            /* align-content 对于两个同级并且在一行显示的元素无效 */
            align-items: center;
            margin:  100px auto;
            overflow: hidden;
            border-radius: 50%;
            width: 400px;
            height: 400px;
            border: 1px solid #ccc;
            -moz-animation: move 3s linear infinite;
            -o-animation: move 3s linear infinite;
            -webkit-animation: move 3s linear infinite;
            animation: move 3s linear infinite;
            background:-webkit-linear-gradient(black 50%, white 50%);
            background:-moz-linear-gradient(black 50%, white 50%);
            background:-ms-linear-gradient(black 50%, white 50%);
            background:-o-linear-gradient(black 50%, white 50%);
            background:linear-gradient(black 50%, white 50%);
        }
        div::after, div::before{
            content: "";
            display: block;
            width: 50px;
            height: 50px;
            border: 75px solid transparent;
            border-radius: 50%;
        }
        div::after {
            border-color: #000;
            background-color: #fff;
        }
        div::before {
            border-color: #fff;
            background-color: #000;
        }
    
        @-o-keyframes move{
             from{ transform:rotate(0deg);
             }
             to{ transform:rotate(360deg);
             }
         }
        @-moz-keyframes move{
             from{ transform:rotate(0deg);
             }
             to{ transform:rotate(360deg);
             }
         }
        @-webkit-keyframes move{
             from{ transform:rotate(0deg);
             }
             to{ transform:rotate(360deg);
             }
         }
         @keyframes move{
             from{ transform:rotate(0deg);
             }
             to{ transform:rotate(360deg);
|  |  |
|--|--|
|  |  |

             }
         }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值