I tried to make the CSS transitions
to play one after other ,means first it has to transform the width and later height.
I tried with couple of options but everything is in vain.I achieved this in the javascript
But can some CSS
professionals help to explore this and break it up.Thanks in advance.
<style>
div {
width: 100px;
height: 100px;
background: red;
-webkit-transition: width 2s;
transition: all 2s;
}
div:hover {
width: 300px;
height:500px;
}
</style>
For multiple transitions, use the CSS3 transition property, which is a shorthand property. It sets the property, duration, timing, and delay of the transition in a single line.
To create a CSS animation sequence, you style the element you want to animate with the animation property or its sub-properties. This lets you configure the timing, duration, and other details of how the animation sequence should progress.
CSS Demo: transition-delayA value of 0s (or 0ms ) will begin the transition effect immediately. A positive value will delay the start of the transition effect for the given length of time. A negative value will begin the transition effect immediately, and partway through the effect.
That's the concept of multi-step animations in a nutshell: more than one change taking place in the animation from start to finish.
Break up the individual transition properties into comma-separated values for ease of reference....then just use transition delay to sequence them.
div {
width: 100px;
height: 100px;
background: red;
transition-property: width, height;
transition-duration:2s, 4s;
transition-delay:0s, 2s;
transition-timing-function:linear;
}
div:hover {
width: 300px;
height: 300px;
}
<div></div>
Just use the transition-delay
property in the transition
shorthand to do multiple transitions in sequence in one CSS rule.
-webkit-transition: width 2s, height 2s ease 2s;
transition: width 2s, height 2s ease 2s;
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