一个div最简方法画太极图
直接上代码,一目了然
html
<div class="太极图"/>
css
.太极图 {
--直径: 360px;
position: relative;
width: var(--直径);
height: var(--直径);
background: linear-gradient(to right, white 50%, black 50%);
border-radius: 50%;
box-shadow: 0 0 12px gray;
&:before,
&:after {
content: '';
display: block;
position: absolute;
width: calc(var(--直径)/2);
height: calc(var(--直径)/2);
left: 50%;
border-radius: 50%;
}
&:before {
top: 25%;
translate: -50% -50%;
background: radial-gradient(black 25%, white 26%);
}
&:after {
bottom: 25%;
translate: -50% 50%;
background: radial-gradient(white 25%, black 26%);
}
}