CSS画出中国结

思路:先画出4个U形,将它们2D旋转排列,在另外建两个Div,给他们设置CSS属性,使边框达到半圆半直角,在与U形连接,用一个DIV盒子装起来,旋转45度;

参考代码:

<style type="text/css">
        #p2{
            transform: rotate(-45deg);
        }
        #dU1,#dU2,#dU3,#dU4{
            width: 155px;
            height: 50px;
            border-style: solid;
            border-width: 5px;
            border-color: red;
            border-radius: 0 50px 50px 0;
            border-left:none ;
            position: absolute;
        }
        #dU1{
            
            top: 200px;
            left: 200px;
        }
        #dU2{
            transform: rotate(180deg);
            top: 255px;
            left: 155px;
        }
        #dU3{
            transform: rotate(90deg);
            left: 145px;
            top: 250px;
        }
        #dU4{
            transform: rotate(-90deg);
            top: 200px;
            left: 200px;
        }
        #dO1,#dO2{
            width: 40px;
            height: 40px;
            border: #FF0000 5px solid;
            position: absolute;
        }
        #dO1{
            left: 150px;
            top: 155px;
            border-radius: 50px 50px 0px 50px;
        }
        #dO2{
            left: 305px;
            top: 310px;
            border-radius: 0px 50px 50px 50px;
        }
    </style>

<body>
            <div id="p2">
                <div id="dU1">
                    
                </div>
                <div id="dU2">
                    
                </div>
                <div id="dU3">
                    
                </div>
                <div id="dU4">
                    
                </div>
                <div id="dO1">
                    
                </div>
                <div id="dO2">
                    
                </div>
            </div>
            
            
    </body>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值