← 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:
css
-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:
css
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

If you found this post helpful, please consider giving the repository a star on GitHub or sharing the post on your favorite social networks 😍. Your support would mean a lot to me!

Questions? 🙋

Do you have any questions about front-end development? If so, feel free to create a new issue on GitHub using the button below. I'm happy to help with any topic you'd like to learn more about, even beyond what's covered in this post.
While I have a long list of upcoming topics, I'm always eager to prioritize your questions and ideas for future content. Let's learn and grow together! Sharing knowledge is the best way to elevate ourselves 🥷.
Ask me questions

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