美文网首页
使用clip-path属性和伪元素实现矩形切角

使用clip-path属性和伪元素实现矩形切角

作者: Thesand | 来源:发表于2020-08-05 17:26 被阅读0次

效果图

Snipaste_2020-08-03_16-12-33.png

代码

    <div class="box"></div>

     <style>
        .box {
            width: 200px;
            height: 100px;
            box-shadow: 0 0 20px #0ABBAC inset;
            border: 1px solid #0ABBAC;
            position: relative;
            clip-path: polygon(15px 0, 100% 0, 
                    100% calc(100% - 15px), calc(100% - 15px) 100%,
                    15px 100%,0 15px)
        }

        .box::before {
            content: '';
            width: 0;
            height: 0;
            position: absolute;
            right: 0;
            bottom: 0;
            border-bottom: 15px solid #0ABBAC;
            border-left: 15px solid transparent;
        }

        .box::after {
            content: '';
            width: 0;
            height: 0;
            position: absolute;
            left: 0;
            top: 0;
            width: 0;
            height: 0;
            border-top: 15px solid #0ABBAC;
            border-right: 15px solid transparent;
        }


    </style>

相关文章

网友评论

      本文标题:使用clip-path属性和伪元素实现矩形切角

      本文链接:https://www.haomeiwen.com/subject/txqbrktx.html