Skip to content

How to Apply Multiple Transitions and Animations Due to Overridden Declarations in CSS #14846

Answered by blitzsprinter
morganm94 asked this question in Help
Discussion options

You must be logged in to vote

The issue you are experiencing is due to the fact that CSS overrides any previous declarations of the same property within the same selector. In your code example, the transitions for the width and height properties in #sectionA are being overridden by the last declaration of height transition. Similarly, the animations for #sectionB are being overridden when the element is hovered.

To apply multiple transitions and animations to different elements without being overridden, you have a few options:

  1. Combine Transitions You can combine multiple transitions into a single transition property by specifying all the properties and durations separated by commas. Here's an updated version of your …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@morganm94
Comment options

Answer selected by morganm94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants