Part of the CSS point is to separate the content from the presentation in order to make it easy to change the presentation without changing the content. If you have class="white bgColorBlue fontSize140" everywhere, you defeated this target; you could just go with style="color: white; background-color: blue; font-size: 140%" . Your classes should say that you do not mean what you want it to look like.
If you find yourself repeating certain settings for many classes, such as the following
.PreReleaseText { font-size: 140% } .SpecLabel { font-size: 140%; background-color: white } .SomeOtherThing { font-size: 140% }
Instead, you can combine several of them into one rule.
.PreReleaseText, .SpecLabel, .SomeOtherThing { font-size: 140% } .SpecLabel { background-color: white }
If you really have several classes that are synonymous with each other, you might think about why this is so. Why are all these styles the same? Is there some kind of class name you can come up with that covers all of these uses? Or just by chance that they look the same? If it's just by accident, then they should have separate rules, so you can easily update the styles of each class yourself. If there is any unifying theme, perhaps you should combine them into one class.
Do not forget to think about what will happen on different media or in the redesign. Imagine that the company is being bought back and you want to change the color scheme in accordance with the new corporate colors, without making a complete reorganization. If you have a .bgColorWhite class, but only some things marked with this class should change to a new color in the redesign, you will have to go through all your templates and markup again to separate the classes, but if you have designated them with more meaningful classes, you can just adjust the colors in the respective classes.
These are some general guidelines; You should always use what is best for you. If you had a more specific example, I could suggest a better way to refactor your classes for your specific need.
source share