Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Fluid and Intrinsic Layouts (Summary)

Rosa’s pool timetable is rebuilt, and you’ve finished Fluid and Intrinsic Layouts. You can now build layouts whose type and spacing scale smoothly, whose cards line up across a row with subgrid, and whose components adapt to the space they’re given with container queries and units.

Before and After

  • Fluid type: At 4vw, Riverside Lido’s timetable heading was 12.8 pixels on a phone 320 pixels wide, smaller than the text below it. In a browser window 1280 pixels wide, 200% zoom couldn’t enlarge it: it stayed 51.2 pixels on screen. With a rem part inside clamp(), it’s 40 pixels on that phone. In the 1280-pixel window, it’s 45 pixels, and 200% zoom draws it 1.85 times as big, at about 83 pixels on screen.
  • Subgrid: The Leisure Centre’s long name pushed its opening times down below the other cards’. Now each pool card is a subgrid that spans the pool list’s three rows, so the names, the opening times and the lane badges share lines across the row.
  • Container queries and units: The session card took its layout from a media query, which sees only the window. That squeezed the sidebar’s title into a column 73 pixels wide. Now the main column’s sessions and the sidebar are containers. The card goes wide only where its slot has room and sizes its title with cqi. In the sidebar, a style query turns it compact.
  • Viewport units: On the phone model, the header at 100vh was 720 pixels tall, so its last 80 pixels sat under the toolbar. At min-height: 100svh, it’s 640 pixels, and it keeps that height as the toolbar hides.

Things to Remember

  • Fluid sizes keep a rem part: check them at 200% zoom.
  • A subgridded card spans the rows it shares.
  • A container unit measures the nearest container that answers for its axis, or else the small viewport.
  • Keep a default that works without style queries.
  • Full-height header: min-height: 100svh. Full-screen panel: 100dvh.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

00:00 Rosa’s pool timetable is rebuilt, and you’ve finished the course. You can now build layouts whose type and spacing scale smoothly, whose cards line up across a row with subgrid, and whose components adapt to the space they’re given with container queries and units.

00:18 At 4vw, Rosa’s heading was 12.8 pixels on a 320-pixel phone, smaller than her text. In a 1280-pixel window, 200% zoom couldn’t enlarge it. With a rem part inside clamp(), it’s 40 pixels on the phone.

00:36 In that window, 200% zoom draws it 1.85 times as big. The Leisure Centre’s long name pushed its times down. Now each card is a subgrid spanning the list’s three rows, so names, times and badges share lines.

00:55 The session card took its layout from a media query, which sees only the window. That squeezed the sidebar’s title into 73 pixels. Now each slot is a container.

01:06 The card goes wide where there’s room and sizes its title with cqi. In the sidebar, a style query turns it compact. At 100vh, the header was 720 pixels, and its last 80 sat under Rosa’s toolbar.

01:22 At a minimum height of 100svh, it’s 640, and it holds as the toolbar hides.

01:30 Remember these. Give every fluid size a rem part, and check it at 200% zoom. Span a subgridded card across the rows it shares. A container unit measures the nearest container that answers for its axis, or else the small viewport.

01:45 Keep a default that works without style queries. And use svh for a full-height header, and dvh for a full-screen panel.

01:55 Compare yours with the finished site in the course’s download. Then carry on with the next course in the Modern CSS and Accessible Interfaces path.

02:06 Thanks for following along.

Become a Member to join the conversation.