
The core idea
Responsive web design aims to make a website usable across different viewport sizes, from narrow phones to large desktop displays. The layout adapts instead of assuming one fixed screen width.
How it works
Start with a flexible layout. CSS Grid and Flexbox can distribute space while allowing items to wrap or change arrangement. Relative units such as percentages, rem, and minmax help create adaptable components.
Practical considerations
Images should not overflow their containers. A common baseline is max-width: 100% and height: auto. For art direction or different image sizes, use the picture element and srcset where appropriate.
A useful way to apply it
Media queries apply styles at chosen breakpoints. Choose breakpoints based on where the content needs adjustment rather than targeting a list of specific devices.
Keep learning
Test with browser developer tools and on real devices when possible. Check text size, navigation, touch targets, horizontal overflow, and whether important content remains easy to reach.
Frequently asked questions
What is a responsive website?
A responsive website adapts its layout and content presentation to different viewport sizes.
Should I design for mobile first?
A mobile-first approach is often useful because it encourages prioritising essential content before adding wider-screen enhancements.
What CSS tools help with responsive layouts?
CSS Grid, Flexbox, relative units, fluid sizing, and media queries are common tools.
Continue learning
Explore more topics in the MicroProgrammer library, or browse the Web Development collection for related guides.