美文网首页
css实现尖角号

css实现尖角号

作者: 爱学习的小青蛙 | 来源:发表于2019-01-14 17:38 被阅读0次

    左尖角:


    image.png
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
    </head>
    <style>
    *{
        margin:0;
        padding:0;
    }
    .box{
        position: relative;
        width:500px;
        height: 100px;
        background: #fff;
        border:1px solid #d2d2d2;
        margin:100px;
        background-color: #f6f6f6;
    }
    .trag{
        width: 0;
        height: 0;
        border-width: 9px;
        border-color:transparent;
        overflow: hidden;
        position: absolute;
    }
    .trag1{
         border-style: dashed solid dashed dashed;
    }
    .trag2{
         border-style:dashed dashed solid dashed;
    }
    .trag3{
         border-style: dashed dashed solid dashed;
    }
    .trag4{
         border-style:solid dashed dashed dashed;
    }
    
    .trag-right{
        border-right-color: #d2d2d2;
        top: 30px;
        left: -19px;
    }
    .trag-left{
        border-right-color: #f6f6f6;
        top: 30px;
        left: -18px;
    }
    .trag-top{
       border-bottom-color: #d2d2d2;
        top: -18px;
        left: 300px;
    }
    .trag-btm{
        border-bottom-color: #f6f6f6;
        top: -17px;
        left: 300px;
    }
    .trag-right2{
        border-left-color: #d2d2d2;
        top: 30px;
        left: 500px;
    }
    .trag-left2{
        border-left-color: #f6f6f6;
        top: 30px;
        left: 499px;
    }
    .trag-top2{
       border-top-color: #d2d2d2;
        top: 100px;
        left: 300px;
    }
    .trag-btm2{
        border-top-color: #f6f6f6;
        top: 99px;
        left: 300px;
    }
    </style>
    <body>
    <div class="box box1">
        <div class="trag trag1 trag-right"></div>
        <div class="trag trag1 trag-left"></div>
    </div>
    <div class="box box2">
        <div class="trag trag2 trag-top"></div>
        <div class="trag trag2 trag-btm"></div>
    </div>
    <div class="box box3">
        <div class="trag trag3 trag-right2"></div>
        <div class="trag trag3 trag-left2"></div>
    </div>
    <div class="box box4">
        <div class="trag trag4 trag-top2"></div>
        <div class="trag trag4 trag-btm2"></div>
    </div>
    </body>
    </html>
    

    相关文章

      网友评论

          本文标题:css实现尖角号

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