使用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);
        }
    }
相关推荐
想起你的日子26 分钟前
EFCore之Code First
前端·.netcore
框架图36 分钟前
Html语法
前端·html
深耕AI1 小时前
【wordpress系列教程】07 网站迁移与备份
运维·服务器·前端·数据库
joan_852 小时前
input禁止自动填充
前端·elementui·vue
林间风雨2 小时前
layui 2.9.16 版本,根据字段字数最大数,表格自适应字段宽度
前端·javascript·layui
木子啊2 小时前
HTML防窥技巧:让源码难以偷窥
前端·html·查看源码·禁止查看源码
梦6502 小时前
前端路由守卫:掌控页面跳转的 “守门人”
前端
jiayong232 小时前
前端性能优化系列(二):请求优化策略
前端·性能优化
鄭郑2 小时前
【Playwright 学习笔记 03】CSS选择器 定位方法
css·笔记·学习·playwright