org.sonar.css.checks.l10n.common.zero-units.html Maven / Gradle / Ivy
The value of 0 works without specifying unit for length and percentage. There is no difference between
0px
, 0em
, 0%
, or any other zero-value. The units are not important because
the value is still zero. CSS allows you to omit the units for zero values and still remain valid CSS.
It's recommended to remove units for all zero values because these units aren't being used by the browser and
therefore can be safely removed to save bytes.
Note that it is applicable for length and percentage but not for other dimensions such as angle, time, etc.
Noncompliant Code Example
.mybox {
margin: 0px;
width: 0%;
padding: 10px 0px;
}
Compliant Solution
.mybox {
margin: 0;
width: 0;
padding: 10px 0;
}
.mybox {
angle: 0grad;
transition-duration: 0s;
}
See
stylelint Related Rules
© 2015 - 2024 Weber Informatics LLC | Privacy Policy