<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
background: lightblue;
}
div {
width: 200px;
height: 200px;
/* 线性渐变,白黑各一半 */
background: linear-gradient(white 50%, black 50%);
margin: 10px auto;
/* 弹性盒子,水平显示 */
display: flex;
/* 侧轴居中 */
align-items: center;
border-radius: 50%;
}
div::before {
content: "";
display: block;
width: 100px;
height: 100px;
background: radial-gradient(black 25%, white 25%);
border-radius: 50%;
}
div::after {
content: "";
display: block;
width: 100px;
height: 100px;
background: radial-gradient(white 25%, black 25%);
border-radius: 50%;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
CSS画太极图小案例
扫描二维码,在手机上阅读