热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

有没有理由在drop-shadow上使用cssbox-shadow?-Isthereanyreasontousecssbox-shadowoverdrop-shadow?

Assumingclientcompatibility,isthereanysituationwhereCSSbox-shadowispreferabletofilter:

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

假设客户端兼容性,是否有任何情况下CSS box-shadow比filter:shadow-shadow更可取。

From the article it seems like drop-shadow is a HW accelerated superset of box-shadow. This means that we should basically always use drop-shadow instead of box-shadow?

从文章看来,drop-shadow是一个硬件加速的盒子阴影超集。这意味着我们基本上应该总是使用drop-shadow而不是box-shadow?

2 个解决方案

#1


6  

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.

box-shadow和filter之间只有一个区别:drop-shadow。使用box-shadow可以使用嵌入阴影,但不能使用filter:drop-shadow。一切都取决于你。检查此示例。

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

为什么最好使用过滤器的盒子阴影: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.

此外,还有一个图像示例,其中最好使用滤镜:drop-shadow。第一个具有矩形阴影,但另一个具有跟随图像边缘的阴影。

#2


2  

Problem is that there is limited browser support for filter at the moment with box-shadow being much more supported.

问题是目前对于过滤器的浏览器支持有限,因为盒子阴影得到更多支持。

  • Browser support for filter
  • 浏览器支持过滤器

  • Browser support for box-shadow
  • 浏览器支持box-shadow


推荐阅读
author-avatar
今天是星期天嘛_512
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有