Why layout matters
Most African users browse on mobile. Solid CSS layout skills help you ship fast, responsive interfaces without heavy frameworks.
Flexbox fundamentals
.card-row {
display: flex;
flex-wrap: wrap;
gap: 1rem;
justify-content: space-between;
align-items: center;
}When to use Flexbox
- Navigation bars
- Card rows with variable content
- Centering elements vertically and horizontally
CSS Grid for page structure
.docs-layout {
display: grid;
grid-template-columns: 240px minmax(0, 1fr) 220px;
gap: 2rem;
max-width: 1280px;
margin: 0 auto;
}
@media (max-width: 1024px) {
.docs-layout {
grid-template-columns: 1fr;
}
}Responsive units
Prefer rem, %, and min() for typography and spacing:
.hero-title {
font-size: clamp(1.75rem, 4vw, 3rem);
line-height: 1.15;
}Next steps
Combine these patterns with semantic HTML, then move on to JavaScript for interactivity.
Written by
ZA
Zainab Adeyemi
Frontend Engineer, Lagos
Published April 10, 2025
Zainab builds accessible web experiences for fintech and education startups in West Africa.
