WeCodeAcademy

Step 4: Make it responsive

On a phone, three columns are far too narrow. A media query applies rules only when a condition is true. Below 640px wide we switch the grid to one column, stack the navigation links and make the heading a little smaller.

Examplehtml
Open in editor »

To see it work, open this page in the Try it editor (the link under the example) and drag the result narrower, or use your browser's responsive mode. Real pages also need <meta name="viewport" content="width=device-width, initial-scale=1"> in the head so phones do not zoom out.

Quick check

What does @media (max-width: 640px) { ... } do?

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.