Left/right transparent cut out arrow

后端 未结 4 2052
猫巷女王i
猫巷女王i 2021-01-19 04:02

I am aware this has been answered previously however that was for the bottom of a div and I cannot work out how to do it for the left and right of a div.

I am trying

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-19 04:20

    You could use CSS3's clip-path property but it's a bit bleeding-edge. However, if you don't need to support IE there are plenty of useful examples at http://css-tricks.com/clipping-masking-css/

    div {background: yellow; width:400px; height:300px;}
    div img {
        -webkit-clip-path: polygon(10% 0%, 90% 0%, 90% 100%, 90% 40%, 100% 50%, 90% 60%, 90% 100%, 10% 100%, 10% 60%, 0% 50%, 10% 40%);  
        clip-path: polygon(10% 0%, 90% 0%, 90% 100%, 90% 40%, 100% 50%, 90% 60%, 90% 100%, 10% 100%, 10% 60%, 0% 50%, 10% 40%);
    }

提交回复
热议问题