使用css做一个旋转的八卦图

使用css做一个旋转的八卦图

1, html部分

html 复制代码
<div class="tai">
 	<div class="bai"></div>
    <div class="hei"></div>
</div>

2, css部分

css 复制代码
.tai{
        width: 200px;
        height: 200px;
        border: 1px solid #000;
        background: linear-gradient(#fff 50%, #000 50%); // 使用渐变添加背景颜色
        border-radius: 50%;
        display: flex;
        align-items: center;

        .bai{
            height: 50%;
            width: 50%;
            background: #fff;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        // 白色部分黑色小圆点
        .bai::after{
            content: '';
            width: 30px;
            height: 30px;
            background: #000;
            border-radius: 50%;
        }

        .hei{
            height: 50%;
            width: 50%;
            background: #000;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        黑色部分白色小圆点
        .hei::after{
            content: '';
            width: 30px;
            height: 30px;
            background: #fff;
            border-radius: 50%;
        }

        // 加个动画旋转起来
        animation: rotate 2s linear infinite;
    }

    @keyframes rotate {
        from{
            transform: rotate(0deg);
        }
        to{
            transform: rotate(360deg);
        }
    }
相关推荐
天天打码13 分钟前
Svelte-无虚拟DOM、极致性能的现代高性能Web开发框架!
前端·node.js·vue·svelte
0思必得021 分钟前
[Web自动化] Selenium元素定位
前端·python·selenium·自动化·html
EEEzhenliang1 小时前
CSS知识概括、总结
前端·css
大阳光男孩1 小时前
ElementUI表格懒加载子级更新数据刷新不生效问题
前端·javascript·elementui
wy3136228211 小时前
C#——意框架(结构说明)
前端·javascript·c#
研☆香1 小时前
JS中的三种显示弹窗
开发语言·前端·javascript
俩毛豆1 小时前
HarmonyOS APP开发-一文讲清使用Web组件加载网页的三种方法-《精通HarmonyOS NEXT :鸿蒙App开发入门与项目化实战》读者福利
前端·华为·harmonyos
C_心欲无痕1 小时前
Next.js 路由系统对比:Pages Router vs App Router
开发语言·前端·javascript
LawrenceLan1 小时前
Flutter 零基础入门(二十二):Text 文本组件与样式系统
开发语言·前端·flutter·dart
运筹vivo@2 小时前
攻防世界:Web_php_unserialize
前端·web安全·php