CSS Reference ยท Practical Pages
Vendor prefixes
What CSS vendor prefixes are, why they existed, which prefixed properties you still need today, and how Autoprefixer and browserslist handle the rest.
A vendor prefix is a short label at the start of a property, value or selector name, such as -webkit-, -moz- or -ms-. Browser makers used them to ship experimental features without claiming the final name. If the design later changed, only prefixed code broke, not the open web.
The scheme caused its own problems: authors had to write the same declaration several times, and sites got stuck on prefixed code. Today new features arrive behind flags instead, not prefixes. Most prefixes you see in old code can be deleted, but a few remain genuinely useful.
.old { -webkit-transition: opacity 0.3s; -moz-transition: opacity 0.3s; transition: opacity 0.3s; }
Try it
Two prefixed features that still work in every current browser: gradient text and a clamped paragraph.
The prefixes
| Prefix | Engine / browsers | Status |
|---|---|---|
-webkit- |
WebKit and Blink (Safari, Chrome, Edge, Opera, Android WebView) | Still present, mostly as legacy aliases and a few real features |
-moz- |
Gecko (Firefox) | A few Firefox-only features remain |
-ms- |
Old Internet Explorer and legacy Edge | Obsolete, safe to remove |
-o- |
Old Presto-based Opera | Obsolete, safe to remove |
Prefixes you may still meet
-webkit-line-clampwithdisplay: -webkit-boxand-webkit-box-orient: vertical: the working way to truncate to N lines. See the line-clamp reference page.-webkit-text-strokeand-webkit-text-fill-color: no unprefixed equivalent is in wide use.-webkit-background-clip: text: the unprefixed form is now widely supported, but keeping both is common for older Safari.-webkit-user-select: Safari has long needed the prefixed form; seeuser-select.-webkit-backdrop-filter: older Safari versions needed it; check a compatibility table before dropping it.::-webkit-scrollbar,::-webkit-search-cancel-buttonand similar pseudo-elements: non-standard, WebKit/Blink only. Preferscrollbar-widthandscrollbar-colorwhere possible.-webkit-font-smoothingand-moz-osx-font-smoothing: non-standard, macOS only, and best avoided.
Prefixes you can usually delete
transition, transform, animation, @keyframes, box-shadow, border-radius, flex and related properties, calc(), linear-gradient(), appearance and box-sizing are all unprefixed in every current browser.
Usage notes
- Let a tool do it. Autoprefixer reads a
browserslisttarget and adds only the prefixes those browsers need. Hand-written prefix lists go stale. - Order matters. Write the prefixed declarations first and the standard one last, so the standard property wins where both exist.
- An unknown prefixed name is ignored, just like any invalid declaration, so extra prefixes cost bytes but do not break pages.
- Never guess. If a feature is new, look it up on a compatibility table instead of adding every prefix by habit.
- Feature queries with
@supportscan test prefixed values, for example@supports (-webkit-backdrop-filter: blur(1px)).
Browser support
Prefixed features work in the engine they are named for, and the -webkit- forms are accepted by all major current browsers for the properties listed above.
Related
-webkit-line-clamp@supports- Deprecated and legacy CSS
- Lesson: Feature Queries