I've seen this notation used a lot, and I was wondering, is there is any notable difference between these two notations?
element#id
{
property: 0;
}
and
element#id
{
property: 0px;
}
I use property: 0px;
all the time, as I find it cleaner looking, but I'm not really sure if the browser interprets 0px
differently than 0
.
Does anyone know which one is better or correct?
Unit identifiers are optional, but there is no noted performance increase (although you are saving two characters).
CSS2 - From W3C CSS 2.1 Specification for Syntax and basic data types:
The format of a length value (denoted by <length> in this specification) is a <number> (with or without a decimal point) immediately followed by a unit identifier (e.g., px, em, etc.). After a zero length, the unit identifier is optional.
(Emphasis mine)
CSS3 - From W3C CSS Values and Units Module Level 3 (Currently in Candidate Recommendation at the time of this writing)
For zero lengths the unit identifier is optional (i.e. can be syntactically represented as the 0).