Disable/turn off inherited CSS3 transitions

Viewed 172244

So I have the following CSS transitions attached to an element:

a { 
  -webkit-transition:color 0.1s ease-in, background-color 0.1s ease-in ;  
  -moz-transition:color 0.1s ease-in, background-color 0.1s ease-in;  
  -o-transition:color 0.1s ease-in, background-color 0.1s ease-in;  
  transition:color 0.1s ease-in, background-color 0.1s ease-in; 
}

Is there a way to disable these inherited transitions on specific elements?

a.tags { transition: none; } 

Doesn't seem to be doing the job.

6 Answers

Another way to remove all transitions is with the unset keyword:

a.tags {
    transition: unset;
}

When used with the transition property, unset is equivalent to initial, since transition is not an inherited property:

a.tags {
    transition: initial;
}

A reader who knows about unset and initial can tell that these solutions are correct immediately, without having to think about the specific syntax of transition.

Additionally there is a possibility to set a list of properties that will get transitioned by setting the property transition-property: width, height;, more details here

Related