Autoprefixer & Vendor Prefixes
-webkit-, -moz-, -ms-) to work in certain browser versions — see Vendor Prefixes for the fuller picture of why these exist and which browsers use which prefix. Autoprefixer is a PostCSS plugin that adds exactly the prefixed declarations your target browsers still need, automatically, based on real usage data — so you almost never have to write a vendor prefix by hand again.Write plain CSS, let the tool add prefixes
The core idea is a clean separation of concerns: you author standard, unprefixed CSS, and Autoprefixer inserts whatever prefixed variants are needed as a build step. This is dramatically more maintainable than writing prefixes by hand, for a few reasons:
Prefix requirements change over time as browsers gain native support — a property that needed
-webkit-two years ago might not need it today. Autoprefixer's data updates independently of your code.Hand-written prefixed CSS is easy to let go stale, and easy to forget when adding a new property.
It keeps your source CSS readable — no repeated near-duplicate declarations cluttering every rule.
Configuring target browsers with Browserslist
browserslist configuration that most modern JS tooling (Babel, Autoprefixer, ESLint plugins) also respects. It can live in package.json:{
"browserslist": [
">0.3%",
"last 2 versions",
"not dead",
"not op_mini all"
]
}.browserslistrc file at the project root:# .browserslistrc > 0.3% last 2 versions not dead not op_mini all
postcss.config.js:module.exports = {
plugins: {
autoprefixer: {},
},
}Before and after
You write this, unprefixed:
.card {
display: flex;
user-select: none;
backdrop-filter: blur(8px);
}And, depending on the exact browsers listed in your Browserslist config, Autoprefixer emits something like this:
.card {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
}Notice the unprefixed declaration is always kept, and always written last within each property group — CSS resolves duplicate properties by using whichever one appears last, so this ordering guarantees that browsers supporting the standard property use it, while older browsers fall back to the matching prefixed version.