Responsive Web Design / CSS / Basic CSS
Design a Blog Post CardTurn an article preview into a clear invitation.
Watch Rob build the project, understand what each part is for, then work through the official freeCodeCamp lab at your own pace.
ORIGINAL WALKTHROUGH · 22:40
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
An article preview should help a visitor decide whether to keep reading. Its image sets context, the heading identifies the subject and the excerpt offers enough information to make the reading link useful.
Use the card wrapper to establish a surface, then distinguish the full-width image from the padded content area. Refine the title and excerpt spacing together rather than adjusting isolated boxes. The final link can look like a button while remaining a navigation element with a meaningful destination.
Group the article preview
Keep image, title, excerpt and reading action in a coherent structure.
Reason about spacing
Separate the card boundary, image width, interior padding and text margins.
Make the action recognizable
Style a navigation link without losing its destination or keyboard usability.

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.
Define the preview
Build the required content and establish the card surface.
Check your understanding: The card’s content is grouped and visually separated from the surrounding page.
Explore topic 1Fit and space the content
Size the image and give the title and excerpt room to read.
Check your understanding: The image fits the card and the text has deliberate interior spacing.
Explore topic 3Connect the full article
Style the reading action and inspect its destination and states.
Check your understanding: The action is recognizable and the official requirements are satisfied.
Explore topic 5SEE HOW THE PARTS FIT
A page with a clear structure
This separate session-preview rule illustrates a card surface and internal text spacing. It is a partial analogous example, not the completed blog card.
.session-preview {
width: 320px;
background: #fff8e7;
border-radius: 14px;
}
.session-summary { padding: 24px; }imageIntroduce the subject visuallycontent areaKeep the title and summary readablereading linkProvide a clear destinationThree things to pay attention to
Full width is relative to a container
Know which box supplies the image’s available width and inspect whether it overflows.
Padding and margin do different jobs
Padding creates space inside the content area; margins separate the elements around it.
A button-shaped link is still a link
It should navigate to relevant content and remain recognizable and keyboard usable.
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 1Group one article preview
UNDERSTAND THE IDEA
A compact preview combines an image, a heading, a short description and a route to the full article. A wrapper keeps that collection together for styling.
What you will do
Review the required card, image and content-container structure, using your own article subject.
<div class="session-preview">
<img src="repair-session.jpg" alt="Learners examining a lamp at a workbench">
<div class="session-summary"><h2>Inside the repair cafe</h2></div>
</div>What to notice: These classes and the local filename belong to a different preview. The file must exist for an actual image to load.
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 2Separate the card from its background
UNDERSTAND THE IDEA
A contrasting surface and rounded corners can define a card’s visual boundary. Width and text alignment influence how its content reads, but they do not replace semantic content.
What you will do
Apply the page and card surface requirements from the official lab.
.session-preview {
width: 320px;
background: #fff8e7;
border-radius: 14px;
text-align: left;
}What to notice: The sample surface and dimensions deliberately differ from the required blog card. Inspect the result at narrow widths rather than assuming a fixed width always fits.
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 3Fit the image to its container
UNDERSTAND THE IDEA
A full-width image can align with the card edges. A border can separate the image from the text area, while automatic height normally preserves image proportions.
What you will do
Set the required image width and bottom border. Check that the image does not spill out of its card.
.session-preview img { width: 100%; height: auto; border-bottom: 2px solid #a5bed0; }What to notice: This is a scoped image rule for a different card. Cropping, rounded corners and source proportions need to be reviewed in the rendered result.
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 4Give the text room to breathe
UNDERSTAND THE IDEA
Padding creates space inside the content container, while margins separate its heading and excerpt from nearby content. These two kinds of spacing solve related but different problems.
What you will do
Complete the content padding and title/excerpt text and margin rules required by the lab.
.session-summary { padding: 24px; }
.session-summary h2 { color: #16324f; margin: 8px 0 16px; }What to notice: These values illustrate spacing roles, not the completed blog stylesheet. Inspect the title, excerpt and action together to judge the rhythm.
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 5Make the reading link easy to identify
UNDERSTAND THE IDEA
A navigation link can be styled with a button-like surface and generous padding. It still navigates, so its text should explain where it leads and its focus should remain visible.
What you will do
Style the required reading link, including its display behavior and hover background, then test the destination.
.guide-action { display: inline-block; padding: 12px 20px; margin: 16px 0; border-radius: 8px; color: white; background: #174c68; }
.guide-action:hover { background: #0d3348; }What to notice: The example is a separate action style. A hover effect supports pointer use; keyboard users also need a visible focus indicator.
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.