使用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);
        }
    }
相关推荐
道不尽世间的沧桑1 小时前
第17篇:网络请求与Axios集成
开发语言·前端·javascript
diemeng11192 小时前
AI前端开发技能变革时代:效率与创新的新范式
前端·人工智能
bin91534 小时前
DeepSeek 助力 Vue 开发:打造丝滑的复制到剪贴板(Copy to Clipboard)
前端·javascript·vue.js·ecmascript·deepseek
晴空万里藏片云6 小时前
elment Table多级表头固定列后,合计行错位显示问题解决
前端·javascript·vue.js
曦月合一6 小时前
html中iframe标签 隐藏滚动条
前端·html·iframe
奶球不是球6 小时前
el-button按钮的loading状态设置
前端·javascript
kidding7236 小时前
前端VUE3的面试题
前端·typescript·compositionapi·fragment·teleport·suspense
Σίσυφος19008 小时前
halcon 条形码、二维码识别、opencv识别
前端·数据库
学代码的小前端8 小时前
0基础学前端-----CSS DAY13
前端·css
css趣多多9 小时前
案例自定义tabBar
前端