Lesson 5 of 8

Transforms

Goal

Motion that's light on the browser

01

Explanation

The transform property moves, scales and rotates an element without touching the page layout, so the elements around it stay put, and the browser runs it on the GPU.

That's where the well-known performance rule comes from: animate only transform and opacity. Animating width or top forces the browser to recalculate the positions of elements on every frame, and the motion stutters.

You can combine several transforms on one line, and their order matters: translate, then rotate, then scale.

02

Your task

When the mouse pointer moves over .tile, lift it and scale it up slightly in a single transform, and make the motion smooth with a transition.

Checks

4 checks
  1. The tile has a transition with a duration above zero
  2. The transition includes transform
  3. A :hover rule sets transform
  4. The transform combines a translate and a scale
03

Hints

0/3
Track lessons0 of 8 done

Go deeper into the box model, custom properties, positioning, container queries and more, so you understand what's really going on behind the styles you see.

Intermediate level, 8 lessons, 1.5 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

Go deeper into the box model, custom properties, positioning, container queries and more, so you understand what's really going on behind the styles you see.

Intermediate level, 8 lessons, 1.5 hours in total.