Put in order · HTML and CSS course · Module 4: Flexbox

Steps for Perfect Centering

Arrange the steps for perfectly centering an element with Flexbox:

Items to put in order

  • 2. Define the container dimensions (width, height)
  • 3. Add justify-content: center
  • 1. Set display: flex on the container
  • 4. Add align-items: center

You can check the correct answer by solving this task in the CodeWorlds game.