CSS 前缀的目的是什么? [英] What is the purpose of CSS prefixes?

查看:22
本文介绍了CSS 前缀的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,如果我们想确保某些 CSS3 功能在任何地方都能使用,我们需要使用 W3C 推荐的前缀版本,例如:

I know that if we want to make sure some CSS3 features work everywhere we need to use the prefixed versions of the W3C recommended one like:

transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-webkit-transition: all 1s ease;

我知道前缀用于实验性功能,但为什么它们是必要的?他们为什么不在原来的 W3C 上测试它们?是否每个 CSS3 功能都有或有每个浏览器的前缀,或者如果他们认为应该创建一个前缀版本?

I know that the prefixes are used for experimental features, but why are they necessary? Why don't they test them on the original W3C one? Does every CSS3 feature has or had a prefix for every browser or they just create a prefixed version if they think they should?

推荐答案

供应商前缀的最初目的是让供应商能够添加他们自己的非标准功能,以便在他们的 CSS 实现中使用.但是,它们中的大多数用于最终成为标准的事物的实验版本.

The original purpose of vendor prefixes was to give vendors the ability to add their own non-standard features for use in their CSS implementations. However, most of them are used for experimental versions of things that eventually become standards.

如果实验属性没有前缀,则意味着它是属性的正确标准版本.如果每个浏览器都以不同的方式呈现它,那么就没有太多的标准.取而代之的是,浏览器会避免实现无前缀的属性,直到确定它是根据标准执行的,然后它才开始支持无前缀的属性,以表示它正确支持此特定标准.

If an experimental property is unprefixed, it implies that it's the correct, standard version of a property. If every browser renders it differently, then there isn't much of a standard. Instead, a browser avoids implementing an unprefixed property until it's sure that it's done so according to the standard, then it starts supporting the unprefixed property as a way of saying it supports this particular standard correctly.

并非每个功能都有前缀;实际上,供应商仅在其认为必要时才创建前缀.

Not every feature has a prefix; indeed, a vendor creates a prefix only if it deems it necessary.

这篇关于CSS 前缀的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆