2021-10-10

使用css写出中国结

一、效果图

 

二、使用步骤

1.HTML

代码如下(示例):

<div id="bb">
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="yuan1"></div>
            <div class="yuan2"></div>
        </div>

2.CSS

代码如下(示例):

body{
                padding: 0rem;
                margin: 0rem;
            }
            #bb{
                margin-left: 550px;
                margin-top: 400px;
            }
            .box1{
                width: 40px;
                height: 160px;
                border:  solid red 15px;
                border-radius: 50px 50px 0px 0px;
                /* border-top-right-radius: 50%;
                border-top-left-radius: 50%; */
            }
            .box1:first-child{
                transform: rotate(40deg);
                margin-left: 128px;
                position: absolute;
                /* border-right-style: none; */
                
            }
            .box1:nth-child(2){
                transform: rotate(-50deg);
                position: absolute;
                margin-left: 120px;
            }
            .box1:nth-child(3){
                transform: rotate(130deg);
                position: absolute;
                margin: 90px 0px 0px 140px;
            }
            .box1:nth-child(4){
                transform: rotate(-140deg);
                position: absolute;
                margin: 85px 0px 0px 125px;
            }
            .yuan1,.yuan2{
                width: 40px;
                height: 40px;
                border: solid #FF0000 15px;
                border-radius: 50% 50% 0% 50%;
                position: absolute;
            }
            .yuan1{
                transform: rotate(-40deg);
                margin: 105px 0px 0px 16px;
            }
            .yuan2{
                transform: rotate(130deg);
                margin: 92px 0px 0px 244px;
            }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值