现在保留这些“-webkit-”“-moz-”“-o-”“-ms-”前缀有多大必要? (截至 2019 年 12 月)

How necessary is it to keep these "-webkit-" "-moz-" "-o-" "-ms-" prefix nowadays? (As of Dec 2019)

我看到很多 CSS 代码,例如:

  -webkit-transition: all 0.3s ease-out;
  -moz-transition: all 0.3s ease-out;
  -o-transition: all 0.3s ease-out;
  -ms-transition: all 0.3s ease-out;
  transition: all 0.3s ease-out;

我只是想知道,这四个属性是否还需要保留前缀?

如果我不需要在非常古老的设备上为用户提供服务,我可以放弃它们吗?

谢谢

什么是供应商前缀?

简而言之,供应商前缀允许您利用实验性 CSS 功能,这些功能已在一种或多种浏览器中实现,但目前还不是主流。

你应该使用供应商前缀吗?

这归结为一个见仁见智的问题,但是W3C的意见是"no, you should not."

Official W3C policy states that you shouldn’t really use experimental properties in production code, but people do, as they want to make sites look cool and keep on the cutting edge.
- W3C page on optimizing content for different browsers

就我个人而言,如果开发人员使用供应商前缀,我绝不会接受 CSS 进入我的代码库。它会自动创建维护问题。如果您坚持在生产代码中使用实验性 CSS 功能,那么您应该在构建期间使用 autoprefixer 等实用程序。