CSS 3ボーダーのギザギザ効果を実現

1785 ワード

CSS 3のlinear-gradientで実現した
 
 
<div class="toothbg"></div>

 
 
.toothbg{width:100%;height:20px;background:#41B61A;

    background-image:-webkit-gradient(linear,50% 0,0 100%,from(transparent), color-stop(.5,transparent),color-stop(.5,#e5e5e5),to(#e5e5e5)),

                    -webkit-gradient(linear,50% 0,100% 100%,from(transparent), color-stop(.5,transparent),color-stop(.5,#e5e5e5),to(#e5e5e5));

    background-image:-moz-linear-gradient(50% 0 -45deg,transparent,transparent 50%,#e5e5e5 50%,#e5e5e5),

                    -moz-linear-gradient(50% 0 -135deg,transparent,transparent 50%,#e5e5e5 50%,#e5e5e5);                                

    background-size:30px 15px;

    background-repeat:repeat-x;

    background-position:0 100%;                    

}