在CSS透视图上使用单位 [英] Using units on CSS perspective
问题描述
只是一个快速的问题,澄清我对CSS 透视
上的单位的混淆。
Just a quick question to clear up some confusion that I have regarding units on CSS perspective
.
CSS转换规范它引用它与 px
例如透视:1000px;
但我已经使用,在许多其他地方,其他人使用它不具有 px
perspective:1000;
,例如W3Schools。
On the CSS Transforms spec it references it with px
e.g. perspective: 1000px;
but I have used and in many other places others have used it without px
e.g. perspective: 1000;
such as on W3Schools.
是否重要?
只要清除这个问题,谢谢。
Just want to clear this up, thanks.
推荐答案
只是因为它被(一些)浏览器接受并不意味着它是正确的。
指定度量单位是 CSS规范要求的,除非该值为零。
Just because it's accepted by (some) browsers doesn't mean it's correct. Specifying a unit of measurement is required by the CSS spec, unless the value is zero.
规格说明:
长度距离测量,并且由< length>在属性定义中。长度是维度。零长度可以代替地表示为<数字>。 '0'。 (换句话说,对于零长度,单位标识符是可选的。)
Lengths refer to distance measurements and are denoted by <length> in the property definitions. A length is a dimension. A zero length may be represented instead as the <number> ‘0’. (In other words, for zero lengths the unit identifier is optional.)
一个维度是一个数字,紧跟一个单位标识符。 / p>
A dimension is a number immediately followed by a unit identifier.
请参阅距离单位和
See the Distance Units and the Other Units for examples.
另请参阅MDN对长度
这篇关于在CSS透视图上使用单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!