🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEcss

css Documentation

LOADING ENGINE...

CSS Transition

Bring your UI to life. Master Duration, Properties, Timing Functions, and Delays.

style.css
.btn {
background: blue;
transition: all 0.5s ease;
}
.btn:hover {
background: red;
transform: scale(1.1);
}
Hover Me
style.css
1 / 9
⏱️

Tutor:The 'transition' property allows you to change property values smoothly, over a given duration, rather than instantly.


Transition Tree

Unlock nodes by mastering Properties, Durations, Timing Functions, and Delays.

Concept 1: Property & Duration

To create a transition, you must specify at least two things: the property you want to add an effect to, and the duration of the effect. If the duration is not specified, the default value is 0, meaning no transition.

System Check

What is the default transition duration?


Community Motion

Share Your Animations

Built a smooth button or a complex card hover? Share your transition snippet.

Enjoying this guide?

Codesyllabus is 100% free and open-source. Support our mission, pay for server infrastructure, and fuel new tutorials by buying us a coffee!

CSS Transitions

Author

Pascual Vila

Frontend Instructor.

The transition property allows you to change property values smoothly over a given duration. This controls the speed when changing CSS properties, instead of having changes happen instantly.

The Transition Properties

  • transition-property: Specifies the name of the CSS property the transition effect is for (e.g., width, background-color).
  • transition-duration: Specifies how many seconds or milliseconds the transition effect takes to complete.
  • transition-timing-function: Specifies the speed curve of the transition effect (e.g., linear, ease-in).
  • transition-delay: Defines a delay (in seconds) for the transition effect start.

Timing Functions Explained

The flow of time isn't always linear. With ease-in, an animation starts slow and speeds up. With ease-out, it starts fast and slows down at the end. These make interfaces feel more natural and organic.

Performance Note

For the smoothest animations (60fps), try to stick to transitioning transform and opacity. Transitioning properties like height or margin can cause layout thrashing and stuttering.

CSS Transition Glossary

Duration
The amount of time it takes for an animation to go from start to finish. Denoted in seconds (s) or milliseconds (ms).
Easing (Timing Function)
A mathematical function that describes how fast the property changes during the transition (e.g., start slow, end fast).
Delay
The time to wait before the transition effect begins.
Shorthand
The ability to write all transition properties in a single line: transition: property duration function delay;