1
\$\begingroup\$

Resharper complain if you have code like this:

border-width: 0px 1px 1px 0px;

and insists that units should be removed from zeroes as they are redundant. They are redundant, that is absolutely true, but I don't like inconsistency that is introduced by removal of units. You get code like this

border-width: 0 1px 1px 0;

which is pretty hideous in my opinion. So, what do you guys think? Should I remove redundant units, or should I disable this warning?

\$\endgroup\$

1 Answer 1

6
\$\begingroup\$

0cm, 0px or 0x corresponding to 0, it doesn't need unit if it's of the same order of magnitude. 0px * 10cm is the same than 0 * 10cm. In this case border-width corresponding to length's order of magnitude it's not necessary to precise the units.

Moreover, for my part, I never specifies the things which are default. Whatever the language. I think it's more readable and elegant. It's my opinion because some people I met prefers specify everything.

I hope my english is not so bad .

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.