当css属性以破折号开头时,是什么意思? [英] What does it mean when a css property starts with a dash?
问题描述
我刚刚从此网站下载了一个css文件,其中包含 -webkit-transform
和 -moz-transform
。
I just downloaded a css file from this website and it contains properties such as -webkit-transform
and -moz-transform
. What does the dash mean and under what circumstances is it required?
对于nity grity,短语vendor prefix指的是 - 或者 - 和 - 之间的内容,
For the nity grity does the phrase "vendor prefix" refer to the - or the content between the - and - (exuding the - and -) or the content between the - and - (including the - themselves)?
换句话说,vender前缀指的是破折号本身,或者是 -
In other words does vender prefix refer to the dash itself or only the content between the dashes or the dashes with the content between them?
推荐答案
-webkit-
和 -moz -
这里称为供应商前缀;它们通常指示CSS的浏览器特定的特征,或者正在开发/仍然是草稿,并且不能被认为是标准的。当这些功能提前使用时,使它在每个浏览器中工作的唯一方法有时为每个浏览器提供一个不同的前缀,这是您在项目中看到的。
-webkit-
and -moz-
here are called vendor prefixes; they generally indicate a browser-specific feature of CSS, or one that’s under development/still a draft and can’t be considered a standard yet. When these features are used "ahead of time", the only way to make it work in every browser is sometimes to provide a different rule with a different prefix for each one — that’s what you see in the project. The idea is that eventually, though, the feature will be standardized, browsers will drop the prefixes, and life will go on.
-webkit-
-webkit-gradient
, for example, was the first way to define a gradient in CSS, but was replaced by a completely different linear-gradient
and radial-gradient
syntax.
一个方便的方法来了解什么浏览器支持某个功能,在我可以使用... 之前,在确定的标准或全局无前缀浏览器支持之前重新使用它。
A convenient way to find out what browsers support a certain feature and what prefixes you need if you’re using it before a definitive standard or global unprefixed browser support is Can I Use….
一些常见的前缀是:
-
-webkit -
基于WebKit的浏览器,包括Chrome / Chromium和Safari -
-moz -
for Firefox -
-ms -
适用于Internet Explorer(9及以上版本) -
-o -
for Opera(pre-WebKit)
-webkit-
for WebKit-based browsers, including Chrome/Chromium and Safari-moz-
for Firefox-ms-
for Internet Explorer (9 and up)-o-
for Opera (pre-WebKit)
这篇关于当css属性以破折号开头时,是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!