Le 13 avril 2020 11:10:32 GMT-04:00, "Ludovic Courtès" <[email protected]> a écrit :
>Hi,
>
>Danny Milosavljevic <[email protected]> skribis:
>
>> a:not(.syntax-symbol) {
>> background-color: blue;
>> }
>
>Nice! It works, but I’d have to spread “not(.syntax-symbol)” in CSS
>files that shouldn’t know about ‘syntax-symbol’ in the first place.
>
>Is there a way to somehow have an ‘a.syntax-symbol’ rule take
>precedence
>over other ‘a’ rules?
>
>Thanks,
>Ludo’.
The a.syntax-symbol is more specific that the a rule, so it already takes
precedence. You can use this to reset a value:
a {
backgraound-color: blue;
}
a.syntak-symbol {
background-color: inherit /*or none*/ ;
}
Of course some a tags might be styled with more specific rules, so you have to
make sure your rule is evn more specific. Alternatively use !important, which
is considered bad practice.