Lesson 3 of 8

Thoughtful motion

Goal

Transitions that respect the user

01

Explanation

Good motion shows the user what just happened; it isn't there to show off. The lightest kind is a transition: you name the property that changes and how long the change takes, and the browser handles the rest.

Animate only transform and opacity, because they don't force the browser to recalculate where elements sit, so the motion stays smooth. Animating width or top makes it choppy.

Motion makes some people genuinely dizzy, so they ask their operating system to reduce it. @media (prefers-reduced-motion: reduce) is how you find out they asked, and respecting it is essential, not an optional extra.

02

Your task

Make .box grow with a smooth transition when the pointer hovers over it, and stop the motion for anyone who asked to reduce it.

Checks

4 checks
  1. The box has a transition with a duration above zero
  2. The transition targets transform, not the box's size
  3. There's a :hover rule with a transform
  4. There's a rule that respects prefers-reduced-motion
03

Hints

0/3
Track lessons0 of 8 done

Learn page layout, form validation, motion and accessibility: the things that make an interface comfortable to use in real life, not just nice to look at.

Advanced level, 8 lessons, 2 hours in total.

index.html
Preview
index.html100%
–/4

Press “Run and check” to grade your code.

4 checks listed under “Your task”.

Track lessons0 of 8 done

Learn page layout, form validation, motion and accessibility: the things that make an interface comfortable to use in real life, not just nice to look at.

Advanced level, 8 lessons, 2 hours in total.