3 of 1 ·Simple layouts

Lesson 3 · Web Explorer
Arranging content on the page.
Make It Beautiful with CSS
CSS changes how a page looks. Change a heading's colour first. Then compare space inside a card, called padding, with space outside it, called margin.
Click to zoomLeft alone, a webpage stacks its boxes vertically, one under another, in the order you wrote them. That's why your page is currently one long column.
Sometimes that's exactly right. Often you want things side by side — three cards in a row, a photo beside some text, a navigation bar across the top.
To do that, you tell a container to lay its children out differently. The tool for this is called flexbox.
Click to zoomPut display: flex on a container and its children line up in a row instead of stacking.
Three properties do most of the work:
display: flex — turn on the row behaviourgap — space between the children, without fiddling with marginsjustify-content — how they spread along the row: flex-start, center, space-betweenThe key thing to remember: you style the container, not the children. The parent decides how its children are arranged.
8 more parts in this lesson
Walkthroughs, code labs, mini-games and the checkpoint quiz unlock when you buy the course.