Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do browsers create vendor prefixes for CSS properties?

Maybe it's an obvious answer, but

Why on earth would browsers decide to create their own vendor prefixes for border-radius and the like?

I mean: Why do I have to type:

-moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; 

Is it because each platform thought "We're cool, we'll come up with a better way to do rounded corners?" It seems totally and inexplicably redundant to type three lines for one.

like image 510
Naftuli Kay Avatar asked Nov 15 '11 05:11

Naftuli Kay


People also ask

What is the purpose of prefixes in CSS?

CSS vendor prefixes, also sometimes known as or CSS browser prefixes, are a way for browser makers to add support for new CSS features before those features are fully supported in all browsers.

What is a vendor prefix in CSS?

Published May 26 2019. Vendor prefixes are one way browsers use to give us CSS developers access to newer features not yet considered stable. Before going on keep in mind this approach is declining in popularity though, in favour of using experimental flags, which must be enabled explicitly in the user's browser.

Do I still need to use vendor prefixes?

Yes, and there will always be, as it's kind of an industry standard that vendors use their prefix on newly drafted properties/methods until those become a standard.


1 Answers

It's because the features were implemented by vendors before the specification reached its final release stage.

The vendor prefixes ensure that there are no clashes with changing functionality etc.

Originally, the point of vendor prefixes was to allow browser makers to start supporting experimental CSS declarations.

Let’s say a W3C working group is discussing a grid declaration (which, incidentally, wouldn’t be such a bad idea). Let’s furthermore say that some people create a draft specification, but others disagree with some of the details. As we know, this process may take ages.

Let’s furthermore say that Microsoft as an experiment decides to implement the proposed grid. At this point in time, Microsoft cannot be certain that the specification will not change. Therefore, instead of adding grid to its CSS, it adds -ms-grid.

The vendor prefix kind of says “this is the Microsoft interpretation of an ongoing proposal.” Thus, if the final definition of grid is different, Microsoft can add a new CSS property grid without breaking pages that depend on -ms-grid

Source.

like image 157
alex Avatar answered Sep 18 '22 07:09

alex