HTML和CSS------太极图

一、用HTML和CSS制作太极图

       

思路 :

1、画出两个长方形

2、把两个长方形,拼成一个正方形

3、把拼成的正方形放到一个与之匹配的正方形中

4、把正方形的边角,锐化成圆

5、把左边‘长方形’背景设为白色,把边‘右长方形’背景设为黑色,

6、取‘长方形’宽为直径画圆,并把圆背景设为白色放到正方形的对称轴上,圆的上边与正方形的上边相切

7、取‘长方形’宽为直径画圆,并把圆背景设为黑色放到正方形的对称轴上,圆的上边与正方形的下边相切

8、取两个小圆,一黑一白,补全太极图

二、代码展示

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>太极图</title>
    <style>
        .tj {
            width: 400px;
            height: 400px;
            position: absolute;
            border: 1px solid #000000;
            border-radius: 50%;
            background-color: #c42929;
            transform-origin: center;
            left: 36%;
            top: 20%;
            /*animation: rotate .9s linear infinite;*/
        }

        @keyframes rotate {
            to {
                transform: rotate(360deg);
            }
        }

        .lf {
            position: absolute;
            width: 200px;
            height: 400px;
            border: 1px solid #000;
            box-sizing: border-box;
            border-radius: 200px 0 0 200px;
            background-color: #fff;
        }

        .rf {
            position: absolute;
            width: 200px;
            height: 400px;
            border: 1px solid #000;
            box-sizing: border-box;
            border-radius: 0 200px 200px 0;
            left: 200px;
            background-color: black;
        }

        .a1 {
            position: absolute;
            width: 200px;
            height: 200px;
            background-color: #fff;
            left: 100px;
            border-radius: 50%;
        }

        .a2 {
            position: absolute;
            width: 200px;
            height: 200px;
            background-color: #000;
            left: 100px;
            top: 200px;
            border-radius: 50%;

        }

        .tj .b1 {
            position: absolute;
            width: 80px;
            height: 80px;
            background-color: #000;
            left: 60px;
            top: 60px;
            border-radius: 50%;
        }

        .tj .b2 {
            position: absolute;
            width: 80px;
            height: 80px;

            left: 60px;
            top: 60px;
            border-radius: 50%;
            background-color: #fff;
        }
    </style>
</head>
<body>

<div class="tj">
    <div class="lf"></div>
    <div class="rf"></div>

    <div class="a1">
        <div class="b1"></div>
    </div>
    <div class="a2">
        <div class="b2"></div>
    </div>



</div>

</body>
</html>

三、效果图展示

  • 7
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值