What does it mean when the css property starts with a dash?

I just downloaded a css file from this website and it contains properties like -webkit-transform and -moz-transform . What does a dash mean and under what circumstances is it required?

In fact, does the phrase “vendor prefix” refer to - or the contents between - and - (exuding - and -) or the contents between - and - (including themselves)?

In other words, does the vender prefix refer to the dash itself, or only to the content between the dash or dash with the contents between them?

+4
source share
2 answers

-webkit- and -moz- here are the vendor prefixes ; they usually indicate a browser-specific CSS feature, or one that is under development / is still a draft and cannot yet be considered a standard. When these functions are used “ahead of time”, the only way to make it work in every browser is to sometimes provide a different rule with a different prefix for each - this is what you see in the project. The idea is that ultimately this feature will be standardized, browsers will drop prefixes, and life will go on.

-webkit-gradient , for example, was the first way to define a gradient in CSS, but was replaced with a completely different syntax linear-gradient and radial-gradient .

A convenient way to find out which browsers support a particular function and which prefixes you need if you use it before the final standard or global support without previewing the browser Can I use ....

Some common prefixes:

  • -webkit- for WebKit-based browsers, including Chrome / Chromium and Safari
  • -moz- for Firefox
  • -ms- for Internet Explorer (9 and above)
  • -o- for Opera (pre-WebKit)
+6
source

These are called vendor prefixes. Different browsers have different prefixes:

  • -webkit- - Webkit-based browsers like Safari and Chrome
  • -moz- - Gecko-based browsers such as Firefox
  • -ms- Internet Explorer
  • -o Presto-based browsers such as Opera

Vendor prefixes are used to denote experimental CSS features. They are used when a particular property or specification is not considered stable and may change in the future. Using a prefix, the browser can experiment with this feature without risking that developers will use the property and sites will crash if the behavior or syntax changes. After the specification becomes final, the prefix will be removed, and some browsers will remove support for the prefix version.

The official W3C guide is that prefixes should be used until the specification from which the property or function reaches the Applicant’s Recommendation,

A general recommendation is to use all vendor prefixes one by one, and the latest version is not applicable.

Mozilla and Chrome (now moving to the Blink engine) changed the policy to hide the function behind the flag, instead of using the prefix. This means that the function will not be available for use if the user does not enable this flag.

For more information, see this CSS working group wiki page: http://wiki.csswg.org/spec/vendor-prefixes

+2
source

All Articles