If it’s 0, you’re not supposed to put, 0px, or, 0em, just 0 by itself?
You are correct!
Zero is zero, there is no place for any unit name. (Though you will see 0px in many web source codes)
Is it standard not to add a padding, margin, property next to 0?
It’s not at all clear what you mean by that.
If you are setting a value of 0 for any attribute - margin, padding, border or whatever, then there is no need to add a unit. (Nothing is nothing; you can’t really measure it in px, em, inches, kilometres or anything else.)
margin: 5px 0 5px 0;
or
padding: 0;
or whatever.
Does that go for width and height also, or only padding and margin?
Zero is zero in all cases.
or whatever is intended to cover whatever property you might be setting to zero. It seemed superfluous to list every possibility.
Doesn’t matter.
0 = 0px = 0em = 0rem = 0vh = 0pc, etc.
<ot>
Is it possible that XML or XHTML does not allow units of measure on “0”?
I didn’t believe that it mattered either until a couple of nights ago when I saw a validator error that said that such units were not permitted on zero. I think I was looking a some code from Blogger, but not sure. Wish I’d documented it, but I didn’t.
</ot>
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.