Cyber Code Academy
Tutorials Academy Courses
Home / CSS / CSS Transitions

CSS Transitions

Transition example

.button {
  background: #2563eb;
  color: white;
  transform: translateY(0);
  transition: background-color 180ms ease, transform 180ms ease;
}
.button:hover { background: #1d4ed8; transform: translateY(-2px); }

Transition specific properties instead of using transition: all when practical.

Respect reduced motion

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

Practice

Add a subtle hover transition to a course card and test the reduced-motion preference.

Want to learn this professionally?

Explore practical IT training at Cyber Code Academy.

View Academy Courses