I'm working on a CSS for a site that features a menu bar. The menu is named 'tabbar.'

.tabbar {

The tabbar needs to appear in different colors on different pages. What is the best semantic naming solution for these variants?

I was thinking of using general descriptive terms such as

.tabbar_blue {}

Or should I list the RBG definition/webcolor specifically? Or is there a better way to do this?


Tom Tolleson

It's up to you. There's no Internet police other than W3C, and they approve both methods.

I usually use the rrggbb method, because I want more control over the exact color. But I then often put a comment to the right of the CSS line with the name of the color I want (e.g. "puce").

For class names, it would be better to use your general descriptive names.

.tabbar_blue {background-color:#0000ff}
.tabbar_yellow {background-color:#ff0000;}


i rather use specific images for every button, with individual color for every different page...

that way i don't mess up colors and stuff... besides... if i don't like something from the button's image, i just have to change the image's appearance and it changes for every button... and, another plus, is that i can choose any design i want, since i create them myself...