使用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 分钟前
react的框架UmiJs(五米)
前端·javascript·react.js
子醉2 小时前
推荐一种适合前端开发使用的解决本地跨域问题的办法
前端
Niyy_2 小时前
前端一个工程构建多个项目,记录一次工程搭建
前端·javascript
xiangxiongfly9153 小时前
CSS link标签
前端·css
岁月宁静4 小时前
AI 多模态全栈应用项目描述
前端·vue.js·node.js
十年磨一剑~4 小时前
html+js开发一个测试工具
javascript·css·html
爱吃巧克力的程序媛4 小时前
将qt界面中加载css或者qss样式
开发语言·css·qt
nn_(nana)5 小时前
修改文件权限--- chmod ,vi/vim,查看文件内容,yum-软件包管理器,systemctl管理系统服务
前端
烛阴5 小时前
从零开始掌握C#核心:变量与数据类型
前端·c#