The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Do you frown on ‘shortcut’ classes? Re: Do you frown on ‘shortcut’ classes?


Short answer: no.

However, rule of thumb is you shouldn’t have a class name that describes a physical attribute, like a class name of red – if you’ve got certain text that you want to be red. Reason being, in the future you may decide that red isn’t the right color, and you want it to be blue. Now you either have blue text that has the class name of red which can be confusing in the future, or you have to go back and change all those class names.

I have what I call utility classes that I have in my skeleton style sheet I always start off with. Things like .leftImage or .rightImage. Now I guess it depends, if you decide on unbolding all of those bold items are you going to remove all the class names, or are you going to change the font-weight to normal in your stylesheet? What if you decide instead of bolding them you just want them a different color, like red. Then you’ll have non-bolded elements that are red with a class name of bold.