Is it possible to generate a box-shadow that follows the shape of a clip-path polygon?

前端 未结 3 1382
温柔的废话
温柔的废话 2020-12-28 15:31

Let\'s say I have this clip path (a triangle generated here)

-webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
clip-path: polygon(50% 0%, 0% 100%, 100%         


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-28 16:05

    You can use a filter on the containing div, try:

    .container {
       filter: drop-shadow(0px 10px 5px rgba(0,0,0,0.1))
    }
    

    eg: https://plnkr.co/edit/kePuv7OLQwawPjiBLg3J?p=preview

提交回复
热议问题