Line numbers put the Spring Seed Swap card exactly where Rosa wanted it, but grid-column: 1 / -1 says where a card goes only once you’ve counted the lines. For an entire page layout, that counting gets hard to follow.
Rosa’s next request covers a whole page. She’d like the work day page to read like a poster: the heading across the top, a photo of a work day on the left, and the details and the jobs in one column of text beside it. In this lesson, you’ll draw that layout in your stylesheet as rows of names, put each part of the page in its named area, and check the names in DevTools. Start with the parts themselves.
Group the Page Into Four Parts
A grid arranges only its direct children, like every layout you’ve set so far. The page needs one child per part before you can name the parts. Open events/work-day.html. Its <main> has seven children: the <h1>, the date paragraph, the sign-up notice, and a heading and a paragraph for each of the two jobs. Seven children would make seven grid items, and Rosa’s layout has four parts.
Put the date paragraph and the sign-up notice inside <div class="details">, and the two jobs inside <div class="jobs">. A <div> fits here because it groups content for layout and means nothing else. Add the photo, work-day.jpg, after the <h1>. Last, give <main> a class, since layout.css styles all three events pages and only this one gets the new layout:
<main class="work-day">
<h1>Saturday Work Day</h1>
<img class="work-photo" src="../images/work-day.jpg"
alt="Volunteers with baskets picking vegetables from raised beds">
<div class="details">
<!-- Move the date paragraph and the sign-up notice here -->
</div>
<div class="jobs">
<!-- Move both jobs here, each an h2 and a p -->
</div>
</main>
Save, and the page still stacks, now with a wide photo under the heading. The wrappers only prepare four children for the grid you’ll add next.
Draw the Layout With Area Names
Line numbers could place the four parts, but the stylesheet wouldn’t show the layout. Grid lets you draw it instead. Add this rule at the end of layout.css: