← Back toCross Browser

CSS vendor prefixes

Written byPhuoc Nguyen
Created
07 Sep, 2022
Before a CSS property or JavaScript API is standardized and becomes popular, each browser tries to support it differently by its own engine. We can give it a try by using a different syntax.
A property might need to be prefixed with an identifier indicating the corresponding browsers, for example:
PrefixBrowser(s)
`-moz-`Firefox
`-ms-`Internet Explorer and Microsoft Edge before it uses the Chromium engine
`-o-`The old versions of Opera before it uses the WebKit engine
`-webkit-`Google Chrome, Safari and newer versions of Opera and Edge
Let's take a look at a simple example. In the old days when the `transition` property is not standardized, we usually had to prefix it to make sure it works in popular browsers:
-webkit-transition: all 400ms ease;
-moz-transition: all 400ms ease;
-ms-transition: all 400ms ease;
-o-transition: all 400ms ease;
transition: all 400ms ease;
However, the `transtion` property is a standard property currently and supported by all modern browsers, we just simply remove all prefixes:
transition: all 400ms ease;
Do we need to track properties which have been standardized and work without being prefixed?
Fortunately, there are more tools to automate the process. They prefix a CSS property automatically based on the data covering which browsers (including versions) support that property. Autoprefixer is one of the most popular tools.

See also

Questions? 🙋

Do you have any questions? Not just about this specific post, but about any topic in front-end development that you'd like to learn more about? If so, feel free to send me a message on Twitter or send me an email. You can find them at the bottom of this page.
I have a long list of upcoming posts, but your questions or ideas for the next one will be my top priority. Let's learn together! Sharing knowledge is the best way to grow 🥷.

Recent posts ⚡

Newsletter 🔔

If you're into front-end technologies and you want to see more of the content I'm creating, then you might want to consider subscribing to my newsletter.
By subscribing, you'll be the first to know about new articles, products, and exclusive promotions.
Don't worry, I won't spam you. And if you ever change your mind, you can unsubscribe at any time.
Phước Nguyễn