Unit 4 ยท Seasonal Calendar
Stage 1 of 7
Unit 4 ยท Stage 1
In earlier units you built pages with HTML and styled them with CSS. This unit adds a powerful new layout tool: CSS Grid. You will use it to build a seasonal calendar. The editor already has your page started. Play with it, or press ๐ Type it with me to be guided. (pause on a highlighted word to see what it does)
<style> block and CSS rules like body { ... }. Any property you have learned lives in the ๐ Glossary at the top. This stage adds one new idea: the grid.Flexbox, from Unit 2, arranges things in a single row or column. Grid works in two directions at once, rows and columns, so it is perfect for a calendar. You turn any element into a grid, then tell it how many columns to make.
Look at the editor. The skeleton, the page title, and the base styles for the body and the <h1> are already there, the same kinds of rules you wrote in Unit 2.
body { ... }#f0f4f0) that feels outdoors before you add any images.h1 { ... }Add a .calendar-grid rule that turns a container into a grid, then add the container itself with four season cards inside.
display: gridgrid-template-columns: repeat(4, 1fr)repeat(4, ...) is shorthand for writing the value four times. 1fr means one fraction of the space, so each column gets 25%.gap: 20px.calendar-grid rule inside <style>, and add the <div class="calendar-grid"> with four <div class="season"> cards inside the <body>. Use the example below, then press โถ Run./* add this inside <style> */
.calendar-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}
<!-- add this inside <body>, under the h1 -->
<div class="calendar-grid">
<div class="season">Season 1</div>
<div class="season">Season 2</div>
<div class="season">Season 3</div>
<div class="season">Season 4</div>
</div>
What CSS value turns an element into a grid? Type it, then press Submit to unlock the last step.
Right now the four cells are invisible. Give each one a white background, padding, rounded corners, and a minimum height so they look like real cards.
background-color: whiteborder-radius: 8pxmin-height: 200px.season rule with a white background, padding, rounded corners, and a minimum height. Use the example below, then press โถ Run..season {
background-color: white;
padding: 20px;
border-radius: 8px;
min-height: 200px;
}
Experiment, then set it back the way you like it.
repeat(4, 1fr) to repeat(2, 1fr) and press Run to see two columns.gap to 40px, then 5px.min-height to 300px.To complete Stage 1, your page needs a .calendar-grid with four columns and styled .season cards. Press Check my work when you are ready. This opens Stage 2 and lets your teacher see that you finished.