CSS Transitions

Understanding the Transition Property

Transitions in CSS let you change property values over a specified duration. The transition property is shorthand for transition-propertytransition-durationtransition-timing-function, and transition-delay.

  • Basic Usage

In this example, the .box element will smoothly transition its background color to green and its width to 200px over 2 seconds when you hover over it.

Tutorials dojo strip
CSS




Timing Function

The transition-timing-function property allows you to define the speed curve of the transition effect.

  • Common Values:
    • ease: Starts slow, speeds up, then slows down at the end.
    • linear: Constant speed from start to finish.
    • ease-in: Starts slow, then speeds up.
    • ease-out: Starts fast, then slows down.
    • ease-in-out: Starts and ends slowly, with speed up in the middle.
CSS




CSS Transitions Example Code

CSS




CSS Labs

Tutorials dojo strip