CSS use of units

Just a quick question to eliminate some of the confusion I have regarding units in CSS perspective.

In the CSS Transforms specification, it refers to px, for example. perspective: 1000px;but I used, and in many other places others used it without px, for example. perspective: 1000;, for example, in W3Schools.

How much preferable? Does it matter?

Just want to clarify this, thanks.

+5
source share
2 answers

Just because it is accepted by some (some) browsers does not mean that it is correct. A unit of measure is required by the CSS specification if the value is not equal to zero.

The spectrum says:

> . - . ​​ < > "0. ( , .)

- , .

( )

Distance Units .

. MDN length

+4

All Articles