HTML & CSS
/Beginner
CSS Transitions
Definition
A CSS module that lets you create gradual transitions between the values of specific CSS properties.
Explain Like I'm New
If you hover over a button and it turns from Blue to Red instantly, it feels jarring. A Transition tells the browser: 'When the color changes, don't do it instantly. Take 0.3 seconds to smoothly blend the blue into red.'
Real World Example
Almost every button on the modern web. When you hover your mouse over it, it smoothly lights up or slightly grows in size.
Common Use Cases
- •Hover effects
- •Smooth UI feedback
Interactive Example
Interview Questions
basic
- What are the two most common properties provided to the `transition` shorthand?
intermediate
- Why is it better to put the `transition` property on the base element rather than the `:hover` state?