Is there any reason to use css box-shadow over drop-shadow?

后端 未结 2 1620
太阳男子
太阳男子 2021-01-20 15:16

Assuming client compatibility, is there any situation where CSS box-shadow is preferable to filter: drop-shadow.

From the article it seems

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-20 15:27

    There is only one difference between box-shadow and filter: drop-shadow. With box-shadow you can use inset shadows, but you can't do it with filter: drop-shadow. All depended on you. Check this example.

    Why is better to use box-shadow insted of filter: drop-shadow?

    • Better browser support
    • Most of developers use it
    • Less code, more options
    • You can use inset shadows
    • You can use more than one shadow

    Also, there is one example with image where is better to use filter: drop-shadow. The first one has rectangle shadow, but the other one has shadow which follow the edge of image.

提交回复
热议问题