All courses
HTML and CSSIntermediate
CSS Layout and Responsive Design
Lay out real pages with flexbox, grid and positioning, then make them work on any screen with media queries, fluid type and custom properties.
Recommended first: Web Foundations: HTML and CSS. This course builds on it.
Free to browse. You sign in at the first lesson so your progress is saved.
What you will be able to do
- Size boxes predictably with border-box, max-width and relative units
- Build nav bars, rows of cards and centred panels with flexbox
- Lay out whole pages and responsive card grids with CSS grid
- Adapt a layout from phone to desktop with mobile-first media queries
- Theme a site with custom properties, including a dark mode
Syllabus
8 modules and 22 lessons. Each lesson is a short read followed by an exercise with tests.
Module 1Sizing and the box model
Make widths mean what they say, centre a column and choose the right unit.3 lessons, about 32 min
Module 2Display and flow
See how block and inline boxes flow down a page, and how to hide them.2 lessons, about 22 min
Module 3Flexbox
Line items up in rows and columns, space them out and centre them.4 lessons, about 50 min
- 6Your first flex containerTurn a parent into a flex container and set its direction and gap.12 min
- 7Building a nav barPosition flex items with justify-content and align-items.14 min
- 8Wrapping and growingLet items wrap onto new lines with flex-wrap, and fill spare space with flex-grow.14 min
- 9Centring with flexboxPut something in the exact middle of the screen.10 min
Module 4CSS grid
Build rows and columns at once, from photo galleries to whole-page layouts.3 lessons, about 41 min
Module 5Positioning
Pin badges to cards, keep a header on screen and control what sits on top.3 lessons, about 36 min
Module 6Responsive design
Make one page work well on phones, tablets and laptops.3 lessons, about 35 min
- 16The viewport meta tagStop phones from shrinking your page to fit a pretend desktop width.8 min
- 17Mobile-first media queriesStart with the small-screen layout and add columns with min-width queries.15 min
- 18Fluid type with clamp()Let headings grow and shrink smoothly with the screen, within limits.12 min