Unit 3 ยท Read All About It
Stage 4 of 7
Unit 3 ยท Stage 4
A front page needs more than one story. You will lay out three article cards side by side using CSS grid, a tool built for rows and columns. (pause on a highlighted word to see what it does)
We added a <main class="articles"> holding three <article class="story"> blocks. CSS grid lines them up in even columns.
display: gridgrid-template-columnsrepeat(3, 1fr) makes 3 columns that each take one equal fraction of the width.gapmargin and max-widthmax-width stops the row from getting too wide, and margin: 0 auto centers it on the page.Set the columns, the spacing, and center the whole block.
.articles rule with display: grid;, grid-template-columns: repeat(3, 1fr);, gap: 24px;, padding: 40px;, max-width: 1100px;, and margin: 0 auto; then press โถ Run.What display value lays items out in rows and columns? Type it, then press Submit to unlock the next steps.
Give each story a white background and a thin border so it reads as a clean card on the newsprint page.
background-colorwhite lifts each story off the cream page.border1px solid #dddddd draws a thin gray outline around each card..story rule with background-color: #ffffff; and border: 1px solid #dddddd; then Run.To complete Stage 4, your .articles needs display: grid and three columns. Press Check my work when you are ready. This opens Stage 5 and lets your teacher see that you finished.