Say we got an element which has a transition. How can one add a class with a transition for another transition property without overwriting and so disabling the other transition?
Example
HTML:
<div class="foo bar">
Lorem ipsum dolor sit amet …
</div>
CSS:
.foo {
transition: background-color 1s ease-in-out;
}
.bar {
transition: box-shadow 0.5s linear;
/* This of course overwrites .foo */
}
Basically, you can't. You would have to write a new selector .foo.bar with both transitions stated. –
.foo {
transition: background-color 1s ease-in-out;
}
.bar {
transition: box-shadow 0.5s linear;
}
.foo.bar {
transition: background-color 1s ease-in-out, box-shadow 0.5s linear;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With