Responsive Web Design / CSS / CSS Positioning
Build a House PaintingPosition the details against one shared boundary.
Watch Rob build the project, understand what each part is for, then work through the official freeCodeCamp lab at your own pace.
ORIGINAL WALKTHROUGH · 50:57
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.
Use the current freeCodeCamp instructions for exact requirements when the recording differs. Step explanations follow the current curriculum; they are not timestamped video chapters.
THE IDEA BEHIND THE BUILD
What this lab teaches
A house diagram has a natural set of spatial relationships: the roof begins at the top, the door sits at the bottom, windows fit between the required bounds and the chimney overlaps behind the body. This lab expresses those relationships with a positioned parent and absolute children.
Keep the thirteen user stories in their official order. Establish the house boundary and exact target dimensions first, then give the five details their geometry before deciding where they belong. Read each offset against the local containing block and compare the window constraints with the actual computed dimensions rather than guessing from a screenshot.
Establish a local reference
Use the relative house to anchor the absolute detail boxes.
Apply edge relationships
Compare top, bottom and horizontal insets against the required geometry.
Inspect painted overlap
Place the chimney behind the body without treating z-index as a global ranking.

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.
Build the house boundary
Create the parent, establish its position and apply the exact dimensions and surface.
Check your understanding: The house is the intended containing block for the details.
Explore requirement 1Create the detail boxes
Add all five required features and give them absolute positioning and visible geometry.
Check your understanding: Each required identity exists in the right parent.
Explore requirement 5Place and layer the features
Anchor roof and door, constrain the windows and set the chimney’s position and overlap.
Check your understanding: All thirteen user stories are satisfied and the composition matches the intended relationships.
Explore requirement 8SEE HOW THE PARTS FIT
A page with a clear structure
This original robot slot uses a bottom edge as its reference. Its classes and dimensions differ from the house lab and do not supply a completed drawing.
.robot-frame { position: relative; }
.robot-slot {
position: absolute;
bottom: 0;
left: 28px;
height: 24px;
}house parentOne positioned containing referencedetail boxesIndependent geometry and local offsetsoverlapChimney behind the painted bodyThree things to pay attention to
The target dimensions are explicit
This exercise requests fixed dimensions without min/max constraints; it is a positioning illustration rather than a complete responsive housing-page design.
Read the window constraints carefully
The official checks compare window top with roof height and window bottom inset with one third of door height. Inspect those values and the rendered result.
A negative layer can disappear
Check ancestor surfaces and stacking contexts when positioning the chimney behind the body.
UNDERSTAND IT HERE · PRACTICE IT THERE
Explore each requirement
Choose a requirement 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.
Requirement 1Create the house boundary
UNDERSTAND THE IDEA
The first requirement establishes one parent for the illustration. A drawing can be built from nested boxes. The markup establishes which shapes share a parent before CSS positions them.
What you will do
Create a div with id="house".
<main>
<div class="robot-frame">
<div class="indicator"></div>
</div>
</main>What to notice: This separate partial robot badge is not the cat or house solution. Nesting determines the available containing relationships.
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.
Requirement 2Anchor the children to the house
UNDERSTAND THE IDEA
A positioned parent supplies the local reference for its absolute children. Relative positioning keeps the box’s normal-flow space while allowing a visual offset. It can also establish the containing block for absolutely positioned descendants.
What you will do
Set the house position to relative as requested.
.robot-frame { position: relative; top: 40px; left: 24px; }What to notice: These different offsets illustrate the movement. Nearby normal-flow content still treats the frame’s original space as occupied.
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.
Requirement 3Set the required fixed dimensions
UNDERSTAND THE IDEA
The lab specifies exact dimensions rather than responsive constraints. An empty block normally has no content height. Explicit dimensions can make an otherwise invisible colored box visible.
What you will do
Set the house width to 500px and height to 400px, without minimum or maximum width/height declarations.
.swatch { width: 180px; height: 30px; }What to notice: These dimensions differ from the marker and painting tasks. The visible outer size can also include borders and padding.
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.
Requirement 4Give the house a visible surface
UNDERSTAND THE IDEA
The illustration needs a recognizable body and outer boundary. A visible border needs an appropriate width and style. Its default color is normally currentColor, so setting color explicitly makes the intention clearer.
What you will do
Set a background color and border on the house.
.overlay { border-left: 6px solid #173c59; }What to notice: The width, style and color here are illustrative. A border adds to a content-box element’s outer dimensions.
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.
Requirement 5Add all five house details
UNDERSTAND THE IDEA
The roof, chimney, two windows and door must belong to the same house. A drawing can be built from nested boxes. The markup establishes which shapes share a parent before CSS positions them.
What you will do
Create the five required divs inside house with IDs chimney, roof, window-1, window-2 and door.
<main>
<div class="robot-frame">
<div class="indicator"></div>
</div>
</main>What to notice: This separate partial robot badge is not the cat or house solution. Nesting determines the available containing relationships.
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.
Requirement 6Position the direct children absolutely
UNDERSTAND THE IDEA
The details should use the positioned house as their local layout reference. An absolutely positioned box leaves normal flow. Its offsets are resolved against its containing block, commonly the nearest positioned ancestor.
What you will do
Give all immediate house children absolute positioning and inspect their containing relationship.
.robot-frame { position: relative; }
.indicator { position: absolute; top: 18px; left: 24px; }What to notice: This is a separate badge detail. Inspect the actual ancestor chain; containing blocks can also be established by properties such as transforms.
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.
Requirement 7Define each detail’s geometry
UNDERSTAND THE IDEA
Every required detail needs its own visible dimensions and surface. An empty block normally has no content height. Explicit dimensions can make an otherwise invisible colored box visible.
What you will do
Set width, height, border and background color for the roof, chimney, two windows and door.
.swatch { width: 180px; height: 30px; }What to notice: These dimensions differ from the marker and painting tasks. The visible outer size can also include borders and padding.
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.
Requirement 8Anchor the roof to the top
UNDERSTAND THE IDEA
A zero top inset places the roof at the containing block’s upper edge. Offsets describe distances from the containing block’s edges. Top and left locate a positioned box; bottom and right provide alternative edge references.
What you will do
Set the roof top value to zero and inspect its visible boundary.
.indicator { position: absolute; top: 28px; left: 36px; }What to notice: These different coordinates belong to a robot badge. Identify the containing block before adjusting a 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.
Requirement 9Anchor the door to the bottom
UNDERSTAND THE IDEA
The lower edge is a clearer reference for a floor-level doorway. A bottom inset can anchor a positioned shape to the lower edge of its containing block. Its height still contributes to where its top appears.
What you will do
Place the door at the bottom of the house using the required bottom relationship.
.robot-slot { position: absolute; bottom: 0; left: 28px; height: 24px; }What to notice: This separate lower slot is not the house door. Borders and box-sizing can affect the visible alignment at the edge.
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.
Requirement 10Keep the windows between the required bounds
UNDERSTAND THE IDEA
The window constraint compares the roof and door measurements with computed window insets. Offsets describe distances from the containing block’s edges. Top and left locate a positioned box; bottom and right provide alternative edge references.
What you will do
Place both windows below the roof: their top inset must exceed roof height, and each bottom inset must exceed one third of door height. Inspect the actual composition too.
.indicator { position: absolute; top: 28px; left: 36px; }What to notice: These different coordinates belong to a robot badge. Identify the containing block before adjusting a 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.
Requirement 11Keep windows and door inside horizontally
UNDERSTAND THE IDEA
Left or right offsets determine each feature’s horizontal placement. Offsets describe distances from the containing block’s edges. Top and left locate a positioned box; bottom and right provide alternative edge references.
What you will do
Set left or right values that keep both windows and the door within the house borders.
.indicator { position: absolute; top: 28px; left: 36px; }What to notice: These different coordinates belong to a robot badge. Identify the containing block before adjusting a 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.
Requirement 12Place the chimney above the house
UNDERSTAND THE IDEA
A negative top offset can lift a detail above the parent’s upper edge. Offsets describe distances from the containing block’s edges. Top and left locate a positioned box; bottom and right provide alternative edge references.
What you will do
Position the chimney at the top of the house; the official check compares its top offset with the negative of its height.
.indicator { position: absolute; top: 28px; left: 36px; }What to notice: These different coordinates belong to a robot badge. Identify the containing block before adjusting a 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.
Requirement 13Layer the chimney behind the body
UNDERSTAND THE IDEA
The chimney’s painted overlap depends on its stacking relationship with the house. Z-index orders eligible boxes within stacking contexts. A larger number is not a universal guarantee that an element will appear above everything else on the page.
What you will do
Set the chimney z-index below the house’s layer as requested. Inspect the overlap and run all thirteen official requirements.
.front-detail { position: absolute; z-index: 2; }
.back-detail { position: absolute; z-index: -1; }What to notice: These are separate badge layers. A negative layer can disappear behind an ancestor’s painted surface; inspect the relevant stacking context.
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.