Frontend development

Stage 1 · Lesson 8 of 9

Responsive, mobile first layout

How the web works, HTML and CSS

design means one page that works on everything from a 360px wide phone to a wide monitor. Mobile first means you write the base styles for small screens first. Then you add min-width media queries, rules that switch on as the screen gets wider.

This keeps the phone version simple instead of undoing desktop styles. Add the viewport meta tag, so phones use their real width instead of shrinking a desktop layout. Use such as rem for text, and percentages or fr for widths.

Let images shrink with max-width: 100%, and let Grid and Flexbox wrap. (CSS variables) let you change spacing or sizes in one place for each screen size. let a component respond to the space it has, rather than the whole screen.

Watch and fixed position elements, which can cover content on a small screen. Test by resizing and in DevTools device mode, then on a real phone.

Common trapdesigning on a laptop and squeezing it down at the end.

A question to check yourself, an AI practice session and 4 cheat sheet entries come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • CourseFree
    The Odin Project

    The Odin Project · Beginner

    Foundations course: HTML, CSS and the web built in your own editor, not a sandbox

  • GuideFree
    web.dev

    Google · Intermediate

    Free Learn HTML, Learn CSS and Learn Accessibility courses explain the why behind layout

Practise

  • Real designs to rebuild, which is where CSS layout finally sticks

Keep handy

  • The reference for every HTML element and CSS property, with browser support notes

  • Quick syntax lookups and try it editors when you only need a reminder

Also worth your time

Mark this stage as not done?