CSS画几何图形系列

一、圆形

<div style="width: 200px; height: 200px;">
        <div style="width: 100px; height: 100px; background-color: pink; border-radius: 50%;"></div>
</div>

 二、三角形

<div style="width: 0; height: 0; border-top: 10px solid transparent; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 10px solid red;"></div>

三、画自适应正方形

<div style="width: 50%; height: 50vw;background: red;"></div>

四、画直线

使用hr实现
<hr style="height: 5px; background: red; border:0px"/>
<div style="width:800px; height:1px; padding:0px; background-color:#D5D5D5; overflow:hidden;"></div>
画竖线
<div style="height:800px; width:1px; padding:0px; overflow:hidden; border-right: 1px solid blue;"></div>

五、画扇形

(1)90°的扇形

左上角都是圆角,其余三个角都是直角,

<div style="width: 100px; height: 100px; background-color: red; border-radius: 100px 0 0;"></div>

(2)其他角度的扇形

<div class="shanxing shanxing2">
        <div class="sx1"></div>
        <div class="sx2"></div>
    </div>

<style>
        .shanxing {
            position: relative;
            width: 200px;
            height: 200px;
            border-radius: 100px;
            background-color: red;
        }
        .shanxing2 .sx1 {
            transform: rotate(-30deg);
            background-color: #fff;
        }
        .shanxing2 .sx2 {
            transform: rotate(-150deg); 
            background-color: #fff;
        }
        .sx1, .sx2 {
            position: absolute;
            width: 200px;
            height: 200px;
            transform: rotate(0deg);
            clip: rect(0 100px 200px 0);
            border-radius: 100px;
            background-color: black;
        }
    </style>

http://www.360doc.com/content/19/0403/13/63018409_826158109.shtml

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Delicia_Lani

你的鼓励将是我写作的动力。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值