Layout

Normal flow, then the tools that override it. Flexbox for lines of content, grid for rows and columns together, and positioning for the things that must step outside.

About 9 hours of study

Learning objectives

Lessons

  1. 1

    Display and normal flow

    How block and inline elements fill a page by default, how the display property changes that, the three ways of hiding things, and what floats are still good for.

  2. 2

    Flexbox: laying things out in a line

    Arrange items along a row or column, share out space, centre anything, and let items wrap, using the main and cross axes.

  3. 3

    Grid: laying things out in two dimensions

    Define rows and columns, place items across them, build whole page layouts with named areas, and create responsive card grids with no media queries.

  4. 4

    Positioning and stacking

    Take elements out of the normal flow to place badges, sticky headers and overlays, and understand why z-index sometimes seems to do nothing.

Module practice

Module quiz

1. Which should you use to hide a menu so that nobody can reach it?
2. After setting flex-direction: column, which property centres items horizontally?
3. Three items have flex: 1 in a container. How is the space shared?
4. A grid has columns 1fr 2fr and is 300px wide with no gap. How wide is the second column?
5. Why does repeat(auto-fit, minmax(200px, 1fr)) need no media queries?
6. A sticky header does nothing. What is a likely cause?
7. A badge with position: absolute is at the corner of the whole page, not the card. What is missing?

‹ Boxes, text and decorationModern, adaptive CSS ›