使用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);
        }
    }
相关推荐
a1779887712几秒前
print.js打印
前端·javascript·html
小林攻城狮2 分钟前
前端实时语音转写:原生 MediaRecorder API 实践
前端·vue.js
Sport2 分钟前
用全会,问全废:CSS高频面试题
前端·javascript·面试
Maxkim4 分钟前
「✍️JS原子笔记 」零基础吃透 Proxy 数据响应式
前端·javascript·面试
hashiqimiya5 分钟前
vue前端打包配置后端代理
前端
小白咚7 分钟前
npm在文件下输入运行命令,授权限制问题window
前端·npm·node.js
清平乐的技术专栏13 分钟前
电脑自带Edge浏览器进行PDF文件合并
前端·edge·pdf
Mintopia19 分钟前
🌈 React-Markdown 教学指南 —— 写给想让网页诗意地“读懂” Markdown 的你 ✨
前端·react.js·markdown
38242782720 分钟前
python:selenium,CSS位置偏移反爬案例
css·python·selenium
LYFlied21 分钟前
浏览器渲染图层详解
前端·性能优化·图形渲染·浏览器