Donate
Back to Introduction to Web Development
Sign in to save your progress and earn a certificate.

Module 4: Responsive Design with Flexbox & Grid

Learning Objectives
  • Explain why responsive design matters for mobile users
  • Build layouts using CSS Flexbox
  • Use media queries to adapt layouts to screen size

Responsive design means a website automatically adapts its layout to different screen sizes, which matters enormously given how much web traffic, especially across Africa, comes from mobile phones rather than desktop computers. CSS Flexbox, set with display: flex, arranges items in a single row or column and distributes space between them flexibly, making it well suited for navigation bars, card layouts, and centering content, while CSS Grid, set with display: grid, handles two-dimensional layouts of rows and columns together and suits full-page structures. Media queries, written like @media (max-width: 768px) { ... }, let you write CSS rules that only apply below or above a certain screen width, which is the core mechanism behind a 'mobile-first' design approach: styling for small screens first, then adding rules for larger ones.

Module Quiz

1. CSS Grid is best suited for:

2. Why is responsive design especially important for audiences in Africa?

3. A media query such as @media (max-width: 768px) is used to: