使用CSS实现奥运五环

在这里插入图片描述

使用CSS实现奥运五环,包括环与环的嵌套

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .circle{                //第一层圆
            width: 200px;
            height: 200px;
            border: 10px solid #000;
            border-radius: 50%;
            position: absolute;
        }
        .circle:after{           //第二层圆
            content: "";
            /*display: block;*/
            width: 200px;
            height: 200px;
            border-radius: 50%; //设置成圆形
            border: 10px solid blue;
            position: absolute;
            top: -10px;
            left: -10px;
        }
        .blue{
            border-color: blue;

        }
        .blue::after{
            border: 10px solid blue;
            z-index: 1;    //向上浮动
            border-bottom-color: transparent;
        }
        .black{
            left: 240px;
        }
        .black::after{
            border: 10px solid black;
            z-index: 1;
            border-left-color: transparent;
            /*border-right-color: transparent;*/
        }
        .red{
            left: 470px;
            border-color: red;
        }
        .red::after{
            border: 10px solid red;
            z-index: 1;
            border-left-color: transparent;
        }
        .yellow{
            left: 120px;
            top: 120px;
            border-color: yellow;
        }
        .yellow::after{
            border: 10px solid yellow;
        }
        .green{
            left: 350px;
            top: 120px;
            border-color: green;
        }
        .green::after{
            border: 10px solid green;
            z-index: 1;
            border-top-color: transparent;//设置顶边框透明
            border-right-color: transparent;
        }
    </style>
</head>
<body>
        <div class="circle blue"></div>
        <div class="circle black"></div>
        <div class="circle red"></div>
        <div class="circle yellow"></div>
        <div class="circle green"></div>
</body>
</html>
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值