首页 技术 正文
技术 2022年11月19日
0 收藏 806 点赞 4,002 浏览 1003 个字

效果图:

CSS 画一个八卦

实现原理:

设置高度为宽度的2倍的一个框,利用 border 补全另一半的宽度,设置圆角

CSS 画一个八卦

用两个 div 设置不同的颜色,定位到圆的上下指定位置。

CSS 画一个八卦

最后只剩下里面的小圆圈了。设个宽高,圆角即可。

CSS 画一个八卦

CSS

         body{
height: 100%;
margin: 0 auto;
}
.bg_box{
width: 100px;
height: 200px;
margin: 200px auto;
background-color: white;
border-color: black;
border-style: solid;
border-width: 2px 2px 2px 100px;
border-radius: 100%;
position: relative;
animation: xuanzhuan 4s linear infinite;
}
.top-circle{
position:absolute;
left:-50px;
top:;
height:100px;
width:100px;
text-align:center;
line-height:100px;
border-radius:100%;
background:#000;
}
.bottom-circle{
position:absolute;
left:-50%;
bottom:;
height:100px;
width:100px;
text-align:center;
line-height:100px;
border-radius:100%;
background:#fff;
}
.small-circle{
display:inline-block;
height:25px;
width:25px;
border-radius:100%;
}
.white{
background:#fff;
}
.black{
background:#000;
}
@keyframes xuanzhuan{
0%{
transform: rotate(0deg);
}
100%{
transform: rotate(360deg);
}
}

HTML

    <div class="bg_box">
<div class="top-circle">
<span class="small-circle white"></span>
</div>
<div class="bottom-circle">
<span class="small-circle black"></span>
</div>
</div>
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,564
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,412
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,185
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905