This goes against best practices. Consider this scenario: you have an article header type that appears on every article page, and a main header that is displayed on every page:
.mainHeader {
font-size:20px;
font-weight:bold:
color:blue;
}
.articleHeader {
font-size:15px;
font-weight:bold:
color:red;
}
Now, what if one day you decide to change the color of your article header from blue to something else. If you modify
.blue {
color:blue;
}
to
.blue {
color:red;
}
this wouldn't be ideal. It's important to name your classes/ids based on their semantic meaning.
The goal of CSS is to be concise so that you can alter the appearance of your entire page with just a few lines of code. The approach suggested here is not concise and therefore not considered good practice.
I recommend using Less CSS as mentioned in the previous answer. Additionally, if you are utilizing a scripting language like Python or PHP on your website, consider using a template engine that supports inheritance. This way, you can generate your own CSS code and utilize variables, which goes beyond traditional CSS capabilities.