使用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);
        }
    }
相关推荐
We་ct几秒前
LeetCode 68. 文本左右对齐:贪心算法的两种实现与深度解析
前端·算法·leetcode·typescript
ShoreKiten10 分钟前
ctfshow-web316
运维·服务器·前端
前端 贾公子20 分钟前
release-it 使用指南
前端·javascript
全栈技术负责人1 小时前
前端团队 AI Core Workflow:从心法到落地
前端·人工智能·状态模式
前端 贾公子1 小时前
深入浅出 CSS 属性:pointer-events: none
前端·css
曾几何时`1 小时前
二分查找(十)1146. 快照数组 pair整理
java·服务器·前端
夏河始溢1 小时前
一八二、webpack、grunt、gulp、rollup、parcel、vite 对比介绍
前端·webpack·gulp
别或许2 小时前
python中的异步调用(直接使用教程)
java·前端·python
xkxnq2 小时前
第四阶段:Vue 进阶与生态整合(第 47 天)(Vue 项目目录结构解析:每个文件夹的作用与规范)
前端·javascript·vue.js
炽烈小老头2 小时前
浏览器渲染原理:从 HTML 到像素的全链路拆解
前端