CSS画太极图小案例


<!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旋转折扇小案例

标题栏三角形按钮小案例

评 论
更换验证码