everyscrub icon indicating copy to clipboard operation
everyscrub copied to clipboard

Change unitless "0" to "px" when scrubbing (e.g. margin)

Open peterflynn opened this issue 12 years ago • 1 comments

  1. Scrub a number like this one: margin: 0;

Result: it changes to e.g. margin: 10;, which is ignored by the browser since it has no units.

It would be better if we automatically tack on units, e.g. margin: 10px;. Icing on the cake would be to automatically remove the unit when scrubbing back to zero.

peterflynn avatar Jul 10 '12 21:07 peterflynn

I saw the same problem. Note that not all CSS numbers have units (e.g. z-index), so you'll need a lookup table to determine whether value requires units. The line-height property is an intersting case because both numbers and lengths (number+units) are valid.

I don't know if I agree with removing the units when you hit zero, because if the units were not originally "px", then you'll need to manually set it back to what it was. Maybe this feature needs preferences for "strip units when zero" which then requires a "default units" preference.

redmunds avatar Jul 23 '12 17:07 redmunds