length-zero-no-unit
Disallow units for zero lengths.
a { top: 0px; }
/** ↑↑
* This zero and this type of length unit */
Lengths refer to distance measurements. A length is a dimension, which is a number immediately followed by a unit identifier. However, for zero lengths the unit identifier is optional. The length units are: em
, ex
, ch
, vw
, vh
, cm
, mm
, in
, pt
, pc
, px
, rem
, vmin
, and vmax
.
This rule ignores lengths within math functions (e.g. calc
).
The fix
option can automatically fix all of the problems reported by this rule.
Options
true
The following patterns are considered problems:
a { top: 0px }
a { top: 0.000em }
The following patterns are not considered problems:
a { top: 0 } /* no unit */