CSS 太极图

在学习CSS伪元素,看到人家画太极图挺意思,跟着画了一个。
在这里插入图片描述
将太极分为三部分,两个小圆和一个大圆,具体看代码把,感觉写的好无聊。。。

<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>taiji</title>
    <link rel="stylesheet" href="./style.css" />
    <style>
        body{
            background-color: #ccc;
        }

        #taiji{
            width: 150px;
            height: 300px;
            margin: 100px auto;
            border-radius: 50%;
            background-color: white;
            border-left: 150px solid black;
        position: relative;
        }

        #taiji::before{    /*":before" 伪元素可以在元素的内容前面插入新内容*/
            content: '';
            position: absolute;
            width: 0px;
            height: 0px;
            padding: 25px;
            border-radius: 50%;
            border: 50px solid black;
            background-color: white;
            top:0px;
            left: -75px;
        }

        #taiji::after{    /*":after" 伪元素可以在元素的内容之后插入新内容*/
            content: '';
            position: absolute;
            width: 0px;
            height: 0px;
            padding: 25px;
            border-radius: 50%;
            border: 50px solid white;
            background-color: black;
            top:150px;
            left: -75px;
        }
    </style>
</head>

<body>
    <div id="taiji"></div>
</body>
</html>

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_36330228/article/details/103395378
今日推荐