CSS Shorthand Syntax Considered an Anti-Pattern

Avatar of Chris Coyier
Chris Coyier on

AWS Amplify - the fastest, easiest way to develop mobile and web apps that scale.

I remember Estelle Weyl used to mention this a lot in her talks. If you set .button { background: red; } you’ve, inadvertently or not, set a whole slew of other properties to their initial values. Harry Roberts demonstrates this clearly and goes so far to say it’s a bad practice.

I don’t avoid it, but I do actively think about it every time I’m about to use a shorthand. I think “I’m not just doing this to be lazy, I’m doing it because I actively want to set all these values.” Plus, the bigger and more unfamiliar the codebase, the less likely I am to use shorthand.

Direct Link →