CSS绘制常见的三角形

给css的世界添点料:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>css绘制三角形</title>
        <style type="text/css">
            div{
                float: left;
            }
            .sj1{
                /*向上的三角形*/
                font-size:26px;
                color: #000000;
                width: 0;
                height: 0;
                border-left: 125px solid transparent;
                border-right: 125px solid transparent;
                border-bottom: 250px solid #00CED1;
            }
            .sj2{
                /*down*/
                /*向下的三角形*/
                font-size: 26px;
                color: #000000;
                width: 0;
                height: 0;
                border-left: 125px solid transparent;
                border-right: 125px solid transparent;
                border-top: 250px solid lightcoral;
            }
            .sj3{
                /*left*/
                /*向左的三角形*/
                font-size: 26px;
                color: #000000;
                width: 0;
                height: 0;
                border-top:125px solid transparent;
                border-right: 250px solid mediumturquoise;
                border-bottom: 125px solid transparent;
            }
            .sj4{
                /*right*/
                /*向右的三角形*/
                font-size: 26px;
                color: #000000;
                width: 0;
                height: 0;
                border-top:125px solid transparent;
                border-left: 250px solid mistyrose;
                border-bottom: 125px solid transparent;
            }
            .sj5{
                /*left top*/
                /*左上角的三角形*/
                font-size: 26px;
                color: #000000;
                width: 0;
                height: 0;
                border-top: 250px solid red;
                border-right: 250px solid transparent;
            }
            .sj6{
                /*bottom right*/
                /*右下角的三角形*/
                font-size: 26px;
                color: #000000;
                width: 0;
                height: 0;
                border-bottom: 250px dashed deepskyblue;
                border-left: 250px solid transparent;
            }
            div:hover{
                cursor: pointer;
                transform: rotate(720deg);
                transition: 5s;
            }
        </style>
    </head>
    <body>

        <!--常见三角形的绘制-->
        <div class="sj1">
            up
        </div>
        <div class="sj2">
            down
        </div>
        <div class="sj3">
            left
        </div>
        <div class="sj4">
            right
        </div>
        <div class="sj5">
            top left
        </div>
        <div class="sj6">
            bottom right
        </div>
    </body>
</html>

加上效果图就一目了然了喔♪(^∇^*)

这里写图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值