css实现尖角号

2019-01-14  本文已影响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>
上一篇下一篇

猜你喜欢

热点阅读