纯 CSS 用一个标签绘制图形

看着不方便的可以直接看原文,链接见底部。

1.

174305_WbDD_2829989.png

<div class="border item2"></div>
.border {
    display: inline-block;
    vertical-align: middle;
    width: 60px;
    height: 60px;
    margin: 30px;
    -webkit-transition: .36s;
    transition: .36s;
}
.item2 {
    border: 60px solid #ccc;
    outline: 60px dotted #fff;
    outline-offset: -59.9px;
    background: #ccc;
}

2.

174931_KCOK_2829989.png

<div class="border item3"></div>
.item3 {
    width: 120px;
    height: 120px;
    -webkit-clip-path: polygon(0% 35%, 35% 35%, 35% 0%, 65% 0%, 65% 35%, 100% 35%, 100% 60%, 65% 60%, 65% 100%, 35% 100%, 35% 60%, 0% 60%);
    clip-path: polygon(0% 35%, 35% 35%, 35% 0%, 65% 0%, 65% 35%, 100% 35%, 100% 60%, 65% 60%, 65% 100%, 35% 100%, 35% 60%, 0% 60%);
    background: #5B88CD;
}

3.

175007_Pzhi_2829989.png

<div class="border item4"></div>
.item4 {
    border-width: 50px;
    border-style: dotted;
    border-color: #5c99d6;
    border-radius: 50%;
}

 4.

175105_TQXU_2829989.png

<div class="border item5"></div>
.item5 {
    border-width: 32px;
    border-style: dotted;
    border-color: #5c99d6;
    background: #ccc;
    border-radius: 50%;
    background-clip: padding-box;
}

参考自:

https://codepen.io/yisi/details/yymGqm/

转载于:https://my.oschina.net/jingyao/blog/983695

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值