
CSS Filter Property: Image and Container Effects
08/05/2024
CSS Preprocessors: Less and Sass
09/05/2024
Vendor prefixes historically let browsers ship experimental or early CSS features. Modern browsers use unprefixed syntax for most established properties.
A prefixed declaration can still be useful for a particular feature and older browser version. Use Can I use to check the browsers you need to support before adding one.
Autoprefixer can add and remove prefixes according to the targets you configure for the project.
The following examples show where prefixes came from and how to manage them.
CSS vendor prefixes
An early browser implementation could expose a feature under a vendor-specific name. The prefix distinguished it from the standard syntax, which might still be changing.
Older stylesheets may contain prefixed forms alongside the standard declaration. The prefixes in the table are useful when reading those stylesheets.
| Prefix | Browser |
| -moz- | Firefox |
| -webkit- | Safari and Chrome |
| -o- | Opera |
| -khtml- | Konqueror |
| -ms- | Internet Explorer and legacy Edge |
Older versions of Firefox used -moz-transform and older versions of Safari and Chrome used -webkit-transform. The example illustrates historical forms. Write the unprefixed transform declaration for modern browsers.
-moz-transform: rotate(20deg); /* Firefox */ -webkit-transform: rotate(20deg); /* Safari and Chrome */ -o-transform: rotate(20deg); /* Opera */ -ms-transform: rotate(20deg); /* Internet Explorer and legacy Edge */ transform: rotate(20deg);
When testing a newer or experimental feature, check the exact feature and browser release. Prefixing an unsupported property does not make it work.
1. Using Autoprefixer in Visual Studio Code
Autoprefixer runs as a PostCSS plugin. You can also use an editor extension that invokes it on a stylesheet, as shown in the screenshot.

Open the Extensions view to find the extension. Then open the Command Palette with Ctrl+Shift+P on Windows or Linux, or Command+Shift+P on macOS, and look for the command provided by the installed extension.
Try the following user-select declaration and inspect the output. The emitted prefixes depend on the target browsers, so the results may differ from the historical example.
-moz-user-select: none; /* Firefox */ -webkit-user-select: none; /* Safari and Chrome */ -ms-user-select: none; /* Internet Explorer and legacy Edge */ user-select: none; /* Controls whether users can select text. */
Some extensions can run on save. For a shared project, configuring the same browser targets in the build helps contributors produce consistent output.
2. Proposed exercise
Run Autoprefixer against a small stylesheet. Compare the output for two different browser target lists and explain why the generated prefixes differ.