🎞️CSS Transition
Also known as CSS Transitions, transition Property
A CSS rule that makes a style change smooth. It runs between two states, like on hover.
Think of it like
It is like a dimmer switch. The light fades to the new level instead of snapping.
Example
Noah moves the mouse over his button. It fades from blue to navy in a fifth of a second.
Why it matters
It is the simplest way to add motion to a web page. It needs no script and very little code.
Definition
Example code
css
.button {
background: blue;
transition: background 200ms ease-out;
}
.button:hover {
background: navy;
}Common mistake
Key takeaways
- 1Two states. From one value to another.
- 2Property, time, easing. Three things to set.
- 3Animate cheap properties. Transform and opacity.