Make a divs top and bottom border have a jagged edge

前端 未结 1 1372
南方客
南方客 2021-01-26 04:00

What would be the best approach to make a border such as this on a div? It would only need to work in modern browsers and nothing below IE10. I have been looking into using bord

1条回答
  •  一向
    一向 (楼主)
    2021-01-26 04:39

    Check this jsfiddle which works in all browsers

    EDIT

    http://jsfiddle.net/yKPe9/3/

    .header:after, .footer:after {
        content: " ";
        display:block;
        position: relative;
        top:0px;
        left:0px;
        width:100%;
        height:36px;
        background: linear-gradient(#2B3A48 0%, transparent 0%), linear-gradient(135deg, #272220 33.33%, transparent 33.33%) 0 0%, #272220 linear-gradient(45deg, #272220 33.33%, #2B3A48 33.33%) 0 0%;
        background: -webkit-linear-gradient(#2B3A48 0%, transparent 0%), -webkit-linear-gradient(135deg, #272220 33.33%, transparent 33.33%) 0 0%, #272220 -webkit-linear-gradient(45deg, #272220 33.33%, #2B3A48 33.33%) 0 0%;
        background: -o-linear-gradient(#2B3A48 0%, transparent 0%), -o-linear-gradient(135deg, #272220 33.33%, transparent 33.33%) 0 0%, #272220 -o-linear-gradient(45deg, #272220 33.33%, #2B3A48 33.33%) 0 0%;
        background: -moz-linear-gradient(#2B3A48 0%, transparent 0%), -moz-linear-gradient(135deg, #272220 33.33%, transparent 33.33%) 0 0%, #272220 -moz-linear-gradient(45deg, #272220 33.33%, #2B3A48 33.33%) 0 0%;
            background: -ms-linear-gradient(#2B3A48 0%, transparent 0%), -ms-linear-gradient(135deg, #272220 33.33%, transparent 33.33%) 0 0%, #272220 -ms-linear-gradient(45deg, #272220 33.33%, #2B3A48 33.33%) 0 0%;
        background-repeat: repeat-x;
        background-size: 0px 100%, 9px 27px, 9px 27px;
    }
    
    .main
    {
        height:200px;
        padding: 36px 0;
        box-sizing:border-box;
       background-color:#2B3A48; 
    }
    .flip-vertical {
        -moz-transform: scaleY(-1);
        -webkit-transform: scaleY(-1);
        -o-transform: scaleY(-1);
        transform: scaleY(-1);
        -ms-filter: flipv; /*IE*/
        filter: flipv; /*IE*/
    }
    

    0 讨论(0)
提交回复
热议问题