Click to See Complete Forum and Search --> : Is correct in CSS code also 0 without px?


toplisek
04-14-2008, 12:43 PM
I have seen when I validate CSS that hey removed px when there is not positive value like 5px.

Is this also 100% correct?

Sample is margin-right : 0;

Fang
04-14-2008, 01:11 PM
A zero value does not require units

aj_nsc
04-14-2008, 01:12 PM
Only when using 0 it is correct. Think about it, does it make a difference if it is 0em, 0%, or 0px?? of course not.

felgall
04-14-2008, 02:43 PM
0in and 0cm also have the exact same size as well.

Of course 1px, 1pt, 1em, 1%, 1in and 1cm are all different sizes (unless you just happen to have your system configured so that two of them just happen to match) which is why you need to define the units since otherwise you have half the browsers assuming you meant attometres and the other half assuming you meant parsecs (except for IE which splits the difference and assumes pixels).