There are different ways to override properties. Assuming you have
.left { background: blue }
eg. any of the following will override it:
a.background-none { background: none; } body .background-none { background: none; } .background-none { background: none !important; }
The first two βgainsβ in the specificity of the selector; the third wins !important , dumb tool.
You can also organize your style sheets so that, for example, a rule
.background-none { background: none; }
wins just in order, i.e. after an otherwise βpowerfulβ rule. But this imposes restrictions and requires that you be careful when reorganizing any style sheets.
These are all examples of CSS Cascade , a key but widely understood concept. It defines precise rules for resolving conflicts between style sheet rules.
PS I used left and background-none since they were used in the question. They are examples of class names that should not be used because they reflect certain rendering rather than structural or semantic roles.
Jukka K. Korpela Jan 06 '14 at 17:44 2014-01-06 17:44
source share