Responsive Web Design / CSS / Absolute and Relative Units
Build an Event Flyer PageGive the event room to fit the screen.
Watch Rob build the project, understand what each part is for, then work through the official freeCodeCamp lab at your own pace.
ORIGINAL WALKTHROUGH · 17:38
Watch with Rob.
Pause whenever you want to try a change. You can return to the lesson at any time.
You are signed in, but video access needs attention. Check your account access. Your saved work is kept.
Video walkthroughs are included with an active Code Zone membership. The written lesson and practice are free.
The current freeCodeCamp requirements are the reference when a recording differs. These guide topics are not timestamped video chapters.
THE IDEA BEHIND THE BUILD
What this lab teaches
A flyer has to identify an event quickly, then give readers a manageable set of details. This lab combines that content hierarchy with sizing rules that depend on the available screen and the boxes inside it.
The central distinction is the reference for each measurement. Viewport width relates to the browser, percentage widths relate to a containing block, and calc can combine measurements to account for padding. Test the actual outer dimensions instead of assuming a relative unit automatically prevents overflow.
Organize the event details
Introduce the event with an image and title, then group the features under headings.
Compare sizing references
Distinguish viewport-relative lengths from percentages of a parent.
Account for padding
Understand why a viewport-height calculation needs to consider the box’s vertical padding.

REVIEW THE REQUIREMENTS · THREE CLEAR GOALS
Your route through the lab
These groups are a reading guide to the lab, rather than timestamped chapters of the video.
Structure the message
Build the introduction and headed feature sections.
Check your understanding: The event and its features are understandable as text.
Explore topic 1Reason about the page box
Set relative width and calculate the minimum content height.
Check your understanding: You can identify the reference for each unit and the padding included in the calculation.
Explore topic 3Inspect the whole flyer
Apply proportional section widths, add the divider and review narrow and wide layouts.
Check your understanding: The page remains readable and meets the official project requirements.
Explore topic 5SEE HOW THE PARTS FIT
A page with a clear structure
This separate repair-day layout uses different dimensions to demonstrate a viewport-based width and a height calculation that accounts for two padding edges.
body {
width: 86vw;
padding-block: 32px;
margin: 0 auto;
min-height: calc(100vh - 64px);
}viewport unitsMeasure against the browser viewportpercentagesMeasure against a containing blockcalc()Combine measurements with an understood relationshipThree things to pay attention to
Relative to what?
A percentage and a viewport unit may look similar while referring to different available space.
Padding affects the outer box
Understand content-box sizing before combining a declared size with additional padding.
One preview is not enough
Check readable text, image bounds and section widths on narrower as well as wider screens.
UNDERSTAND IT HERE · PRACTICE IT THERE
Explore the key concepts
Choose a topic for a plain-English explanation, a separate code example and resources to explore. When you are ready, its button opens the official freeCodeCamp lab. Your official tests and completion stay on freeCodeCamp.
Topic 1Introduce the event in a clear order
UNDERSTAND THE IDEA
An image can attract attention, while the main heading identifies the actual event. The lab specifies their order so the introduction has a predictable structure.
What you will do
Create the header image and main heading in the order required by the official lab.
<header>
<img src="repair-day.jpg" alt="Volunteers working together at a repair bench">
<h1>Community repair day</h1>
</header>What to notice: This is a different event and illustrative filename. A meaningful title should still identify the event when the image is unavailable.
Resources to explore
Read another explanation or experiment with examples before trying the official lab.
Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.
Topic 2Break the details into topics
UNDERSTAND THE IDEA
Sections let readers distinguish different features of an event. Each section heading should identify its topic rather than make the visitor infer it from an image or long paragraph.
What you will do
Build the main region and the required number of headed event-feature sections.
<section>
<h2>What to bring</h2>
<p>Bring one small item you would like to investigate.</p>
</section>What to notice: This fragment describes one separate event feature. Use the official lab to check the complete page structure and required collection size.
Resources to explore
Read another explanation or experiment with examples before trying the official lab.
Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.
Topic 3Distinguish viewport width from parent width
UNDERSTAND THE IDEA
Viewport units depend on the browser viewport, while percentages often depend on a containing block. Choosing between them requires knowing which available space the layout should follow.
What you will do
Apply the body width, centering and padding requirements from the lab.
body { width: 86vw; margin: 0 auto; padding-block: 32px; }What to notice: These different values illustrate a viewport-relative page. Padding can add to the outer width with content-box sizing, so check the actual bounds.
Resources to explore
Read another explanation or experiment with examples before trying the official lab.
Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.
Topic 4Account for vertical padding in a calculation
UNDERSTAND THE IDEA
The calc function combines compatible CSS values and units. Subtracting vertical padding from a viewport-based content height helps explain why the outer box can otherwise exceed the intended height.
What you will do
Set the required minimum-height calculation using the padding in your official project.
body { min-height: calc(100vh - 64px); }What to notice: This subtraction matches the separate example’s two 32px padding edges. Use the padding of the box you are actually styling, not a memorized number.
Resources to explore
Read another explanation or experiment with examples before trying the official lab.
Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.
Topic 5Keep divisions proportional to the layout
UNDERSTAND THE IDEA
A percentage width can make a content section or divider follow its parent’s available width. This differs from sizing it directly against the viewport.
What you will do
Complete the section and divider width requirements and inspect the flyer at different browser widths.
.event-details, hr { width: 92%; margin-inline: auto; }What to notice: The scoped example and percentage differ from the lab. A percentage only makes sense when you know which containing block provides its reference.
Resources to explore
Read another explanation or experiment with examples before trying the official lab.
Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.
Topic 6Review both the structure and the rendered size
UNDERSTAND THE IDEA
A flyer needs a readable hierarchy as well as a box that fits the screen. Checking only one desktop preview can hide overflow or text that becomes uncomfortable on a phone.
What you will do
Run the official tests, then review the headings, divider and layout at narrow and wide widths.
<!-- Review the image, title, feature headings and available space. -->What to notice: This is a review checklist, not a completed flyer. Structural tests and visual inspection provide different kinds of evidence.
Resources to explore
Read another explanation or experiment with examples before trying the official lab.
Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.
READY TO BUILD?
Keep the instructions beside the video.
Start the official lab in a new tab, play the walkthrough here, and pause to make each change yourself. Run freeCodeCamp’s checks before moving on. Write and check your project in the official freeCodeCamp editor.
An independent walkthrough by The Code Zone. Not affiliated with or endorsed by freeCodeCamp. The project and official tests belong to freeCodeCamp; the explanations and visual guide on this page are our companion material.