Why are there vendor prefixes in CSS3? [duplicate]

2019-04-28 01:54发布

问题:

This question already has an answer here:

  • Why do browsers create vendor prefixes for CSS properties? 2 answers

I could understand using them for experimental things that aren't official (ie; not in the CSS3 spec) to prevent name collisions, but why the need for prefixes on shadowing and such?

Shouldn't each vendor be implementing the effects the same, as per the CSS3 specs?

EDIT: Will the prefixes go away once CSS3 is finalized? I just am curious about the history of why some features have prefixes, and some don't, when the effect seems to be the same on all major browsers.

回答1:

This has been asked before, but the short answer is that CSS3 is not a finished product. CSS 2.1 wasn't published until 2011, and only a handful of CSS3 modules have even reached the level of a formal recommendation, so it's premature to talk about a CSS3 specification that is universally implemented. Thankfully, modern browser makers are helping to push things forward and are helping to craft the standard which follows the lead of real-world practice. As they move closer to general standards, the prefixes are dropped.



回答2:

CSS specs are known to take ages to reach the Candidate Recommendation stage which is the stage where they are considered implementation-ready. And even then, a CR can bounce back to WD if problems are found during the implementation and testing stage (this was such a problem with CSS2 that it eventually became CSS2.1).

Since the industry demands fast developments in technology, vendors have to try and implement standards far before they reach maturity. These implementations are often considered experimental and non-final, which brings us back to what you said about them being used for experimental features.

Will the prefixes go away once CSS3 is finalized?

Originally prefixes went away once a module and its implementations were finalized (CSS3 itself is never finalized because it's always growing). These days, measures are being taken to eliminate the use of prefixes for developing technologies almost entirely because they were being misused by both vendors and authors and causing unforeseen but serious interoperability problems; see Chromium/Blink and this CSSWG blog post.