transition-property defines the name of CSS property/ies to which transition should be applied.
📌 transition-duration
Transition duration is nothing but the time period in which transition occurs.
Let's try to play around with these two properties 👇🏻
Consider this code snippet 🔽
div {
transition-property: height;
transition-duration: 2s;
}
div:hover {
height: 200px;
}
The output 👇🏻
Explanation:
Point A - height 100px
Point B - height 200px;
The div element changing its height from 100 to 200px in 2 seconds as mentioned in transition-duration property
Alright moving further, we can add multiple CSS properties in transition-property and multiple transition-duration as well using comma(,) separated values
div {
transition-property: height, width;
transition-duration: 2s 4s;
}
div:hover {
height: 200px;
width: 200px;
}
You can see height is changing is 2s and width in 4s as we have mentioned it respectively.
If in case there is only one value is transition-duration then it will applicable for all the properties mentioned in transition-property
📌 transition-delay
As the property name suggests, it defines how long to wait between the time a property is changed and the transition actually begins.
📌 transition-timing-function
The transition-timing-function property specifies the speed curve of the transition effect. Let's visualize it in next tweet
You can pass following values in transition-timing-function property
- ease (slow start, then fast, then slow)
- linear (same speed)
- ease-in (slow start)
- ease-out (slow end)
- ease-in-out (slow start and slow end)
- cubic-bezier (customizable)
I was going to keep its price $0. Thank god i didn't do that. Still, I love helping others as much as I can. If you can't spend $1 due to some reasons, DM me and I'll send you a free copy ❤️