0

How do I cancel the changes to one individual element in CSS?

Example:

a {
   text-decoration: line-through;
   color: green;
}

Now I would like at the end, a.test to ignore all rules and be displayed in the default way.

The normal colors and decorations of a link would show up on a page without any CSS influence.

All I found was to change every property that changes the element to initial. Is there a universal command that would exempt a.test from all changes?

Aziz
  • 7,685
  • 3
  • 31
  • 54

1 Answers1

0

You can exclude with the :not() CSS pseudo selector

a:not(.test) {
  text-decoration: line-through;
  color: green;
}

Demo: https://jsfiddle.net/azizn/d17vdf35/

Aziz
  • 7,685
  • 3
  • 31
  • 54
  • Thank you very much! This helps a lot specially for other elements. AS a follow-up if there are properties being changed for the entire body, adding :not(.test) or :not(a.home) doesn't help. – Adrian Filip Mar 07 '16 at 13:19