DEV Community

Discussion on: 6 CSS Shorthand properties to improve your web application

Collapse
 
said_alrove profile image
Said Alejandro Rosas Vera • Edited

Shorthands are something I'd take with a grain of salt due to they're not the best choice all the time, for instance let's imagine that we have all the properties required to use the font shorthand, emm... yeah, we can use it, but... will it really improve the readibility of the code? I don't think so.

Shorthands are useful when they don't take too much values (as in background and font) because you can easily understand what a value is about (AND even with not many values available to use as in padding or margin, there could be situations where is better to use each property individually).

But what about the CSS files' size? well... there are many useful plugins available for Gulp, Webpack and many other tools that can give us a hand compressing the files (not only CSS files btw) in order to have lighter stylesheets.

Note: anyways it's always useful to know what are the values that are acceptable in a shorthand because you don't known if it'll be useful in certain situations (as I mentioned before).