When you read CSS code and find some weird code like :
-webkit-,
-moz-,
-o-,
-ms-
Let's understand about themβ‘π
What we're going to cover:-
βΌ What is the vendor prefix.
βΌ Prefixes used by major browsers
βΌ Why we Use?
βΌ property supported by browsers or not
βΌ How we can use vendor prefixes?
βΌ automate the vendor prefix writing
π What is the vendor prefix?
CSS properties starting with -webkit-, -moz-, -ms- or -o- are called vendor prefixes.
These are the vendor-prefixed offered by the relevant rendering engines.
Typically they're used to implement new, or proprietary CSS features,
prior to final clarification by the W3.
π Prefixes used by major browsers :
1. -webkit- :- Chrome, Safari, newer versions of Opera, almost all iOS browsers. 2. -moz- :- Firefox 3. -ms- :- Internet Explorer and Microsoft Edge 4. -o- :- Old versions of Opera.
π Why we Use?
Sometimes websites behave weirdly in different browsers just like,
animation property working fine in the latest firefox,
But not working in the older version of firefox.
This happens because these properties are still not supported by browsers.
To get rid of this behavior we need to specify vendor prefix or,
you can say browser prefix is used to work the property in all browsers.
When using prefixes, keep in mind that they are only temporary.
A lot of properties that needed to have vendor prefixes attached to them are now fully supported and donβt need them.
π How we can know whether the property is supported by browsers or not?
you can use tools like caniuse.com to check the support of property across all major browsers and versions.
π How we can use vendor prefix?
You just need to add a vendor prefix in front of the CSS property name.
just like this π
π automate the vendor prefix writing
Writing Prefix by hand is time-consuming and error-prone.