Command Palette

Search for a command to run...

Hectal
Phase 6: Positioning and Layout Basics
CSS · Exercise 2 of 5 PreviousNext
Beginner

Centre a box both ways

Centre the purple .box exactly in the middle of the grey .stage, horizontally and vertically.

Change only the CSS. Any correct method is fine.

What Check tests

  1. The box is centred horizontally
  2. The box is centred vertically
  3. The box keeps its 80 × 40 size
  4. The stage keeps its 260 × 130 size

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.