Practical CSS Projects: Responsive Navbar & Card Component
Put your CSS knowledge to the test by building two essential real-world components: a responsive navigation bar and an educational course card.
What is it?
A capstone project applying Flexbox, CSS Grid, Box Model, transitions, pseudo-elements, and responsive media queries.
Why is it used?
These two components form the core building blocks of modern web applications and educational portals.
Detailed Explanation
Project 1: A sticky, responsive navigation bar featuring branding, navigation links, and a call-to-action button that reorganizes gracefully on mobile.
Project 2: A course card featuring a language badge, title, level, lesson count, and an interactive 'Start Learning' button with subtle hover elevation.
Syntax Structure
Syntax Blueprint
<!-- Modular CSS Architecture -->
Code Example
CSS Code
/* Course Card Component */
.course-card {
background: #ffffff;
border: 1px solid #eceae4;
border-radius: 12px;
padding: 24px;
display: flex;
flex-direction: column;
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.course-card:hover {
transform: translateY(-4px);
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
border-color: rgba(28, 28, 28, 0.3);
}
.course-card-badge {
align-self: flex-start;
background: #f2eee5;
color: #1c1c1c;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
padding: 4px 10px;
border-radius: 9999px;
margin-bottom: 12px;
}
.course-card-title {
font-size: 20px;
font-weight: 800;
color: #1c1c1c;
margin: 0 0 8px 0;
}
.course-card-desc {
font-size: 14px;
color: #5f5f5d;
line-height: 1.5;
margin-bottom: 20px;
}
.course-card-meta {
display: flex;
gap: 16px;
font-size: 12.5px;
color: #5f5f5d;
margin-bottom: 20px;
padding-top: 14px;
border-top: 1px solid #eceae4;
}
.course-card-btn {
margin-top: auto; /* Pushes button to bottom */
display: inline-flex;
justify-content: center;
align-items: center;
background: #1c1c1c;
color: #fcfbf8;
padding: 10px 18px;
border-radius: 6px;
font-size: 14px;
font-weight: 600;
text-decoration: none;
transition: background 0.2s ease;
}
.course-card-btn:hover {
background: #333333;
}
Explanation of the Code
• Flexbox with `margin-top: auto` on `.course-card-btn` guarantees all buttons align uniformly along the bottom regardless of varying description lengths.
• Clean border and subtle elevation matches the Lovable/IGM aesthetic perfectly.
Expected Output
A professional, responsive course card ready for immediate integration into the IGM Computers tutorial catalog.
Real-World Application
Used across the redesigned IGM Computers tutorial landing page to present the six programming courses.
Common Mistakes to Avoid
• Inconsistent card heights when descriptions have different amounts of text (solved with `margin-top: auto` on CTA button).
• Forgetting transition properties when adding hover states.
Quick Practice Challenge
Add a duration and level tag to the card meta row with SVG icons.
Key Takeaways
• You have completed the CSS3 curriculum!
• You can now build responsive layouts, modern Flexbox components, and custom UI cards.
• Next step: Level up with JavaScript to add logic, interactivity, and state.