Students space a flex row with gap, place its items with justify-content and line them up with align-items, and find out that these go on the row and work in two directions.
Load these into Waypoints Prepare: choose Load URL and paste the copied address, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
Predict and Run 10 min · Investigate 10 min · Mix it up 4 min · Modify 8 min · Make 8 min
Do the Make task yourself in the playground (about 4 minutes).
A flex row is a box with display: flex: its children (the items) sit side by side. justify-content works along the row, the way the items run. align-items works across it, at right angles, so with a row it means up and down. The common slip is to swap them. All three properties go on the box that holds the items, never on the items.
justify-content aligns the words inside each item. Change it to center and flex-end and watch the whole group slide, with the words unchanged.On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.
With your partner, point to where Events will sit in the bar. Then each choose one of the four options and hold up fingers.
Take a vote before running. Ask a student who chose the last option what they think justify-content does to words. The idea to land: it places the items.
Three students stand in a line as a flex row. The class calls out justify-content values and the line moves along the row. Then call out align-items values and they step forward and back.
Listen for pupils who mix up the two directions. Ask which way the row runs.
Telling along from across. Ask which way the row runs, and which property works in that direction, before telling them.
| What you will see | A question to ask | The fix |
|---|---|---|
| The items do not move when justify-content is added. | Does the same rule also have display flex? | justify-content and align-items only work on a box that has display flex. Add display flex to the same rule. |
| align-items: center changes nothing. | Is the row taller than its items? | align-items needs spare room across the row. Give the bar a height, or put the items in a box with more content. |
| The menu links move apart but the club name does not. | Which box did you put display flex on? | Put it on the header that holds both the name and the menu. The menu links are inside nav, so they are not items of the header. |
One possible solution for each task. Other correct programs are fine.
<style>
.menu {
display: flex;
gap: 24px;
}
.bar {
display: flex;
height: 100px;
border: 2px solid navy;
}
</style>
<nav class="menu">
<a href="https://example.com/events">Events</a>
<a href="https://example.com/robots">Robots</a>
<a href="https://example.com/join">Join</a>
</nav>
<div class="bar">
<img src="star.svg" alt="Club star" width="50">
<h2>Robotics Club</h2>
</div>
<style>
.menu {
display: flex;
gap: 24px;
justify-content: center;
}
.bar {
display: flex;
height: 100px;
border: 2px solid navy;
}
</style>
<nav class="menu">
<a href="https://example.com/events">Events</a>
<a href="https://example.com/robots">Robots</a>
<a href="https://example.com/join">Join</a>
</nav>
<div class="bar">
<img src="star.svg" alt="Club star" width="50">
<h2>Robotics Club</h2>
</div>
<style>
.menu {
display: flex;
gap: 24px;
justify-content: center;
}
.bar {
display: flex;
align-items: center;
height: 100px;
border: 2px solid navy;
}
</style>
<nav class="menu">
<a href="https://example.com/events">Events</a>
<a href="https://example.com/robots">Robots</a>
<a href="https://example.com/join">Join</a>
</nav>
<div class="bar">
<img src="star.svg" alt="Club star" width="50">
<h2>Robotics Club</h2>
</div>
<style>
.bar {
display: flex;
justify-content: space-between;
align-items: center;
background-color: lightblue;
padding: 10px;
}
</style>
<header class="bar">
<h1>Robotics Club</h1>
<nav>
<a href="https://example.com/events">Events</a>
<a href="https://example.com/robots">Robots</a>
<a href="https://example.com/join">Join</a>
</nav>
</header>
Stretch: Put the menu in a second flex row of its own, inside the nav, and give it a gap. Then try space-around and space-evenly beside space-between.
Support: Give students the Run page and ask them only to change the word after justify-content, five times, and say what each did.
A flex row has justify-content: center. Which way do the items move, and what happens to the words inside each item?
The group of items moves to the middle of the row. The words stay where they are inside their item.
Next lesson makes a row wrap when it runs out of room, so it fits a phone as well as a laptop. Class idea: look at the menu bars of three websites and decide which values of justify-content and align-items they use.