csslint icon indicating copy to clipboard operation
csslint copied to clipboard

Zero values sometimes need units

Open judowalker opened this issue 7 years ago • 2 comments

In the wiki (https://github.com/CSSLint/csslint/wiki/Disallow-units-for-zero-values) it states that "The value of 0 works without specifying units in all situations where numbers with length units or percentages are allowed."

However, I was able to create a minimal working example which demonstrates that omitting the percentage when the value is 0 can affect how the content is displayed. This happens across browsers: https://codepen.io/judowalker/pen/xrMxWj

judowalker avatar Jul 12 '17 20:07 judowalker

If the containing block's width depends on this element's width, then the resulting layout is undefined in CSS 2.1.

—http://www.w3.org/TR/CSS21/visudet.html#the-width-property

infinnie avatar Aug 07 '17 07:08 infinnie

not all zero do not need units, some like duration, Resolution etc need. such as transition-delay

likezero avatar Nov 16 '17 10:11 likezero