Skip to main content

CSS Layout

10 lessonsAbout 60 minutesIntermediate

This part of the CSS Tutorial runs from Normal Flow through to Multi-column Layout. There are 10 lessons here, and working through them takes about 60 minutes at a steady pace.

It follows on from CSS Box Model, so finish that first if you have not already — the examples below assume you are comfortable with it.

Each lesson below says what it covers before you open it. Read them in order the first time; afterwards this page works as a index you can jump back into when you need to check one thing.

  1. 1Normal FlowUnderstand block flow, inline flow, formatting contexts, containing blocks, and why positioned elements use particular reference boxes. The lesson explains block and inline flow, containing blocks, formatting contexts, margin behavior, and the reference used by positioned descendants.
  2. 2CSS DisplayThe CSS Display property determines how an HTML element is displayed on a webpage.
  3. 3CSS PositionThe CSS Position property is used to control how an element is positioned on a webpage.
  4. 4Anchor PositioningPosition tooltips, menus, and callouts relative to an anchor while providing fallback placements for constrained space. The chapter covers anchor association, relative insets, position areas, sizing, fallbacks, and progressive enhancement.
  5. 5CSS FloatThe CSS Float property is used to position an element to the left or right side of its container, allowing surrounding content to wrap around it.
  6. 6CSS OverflowThe CSS Overflow property controls what happens when content is too large to fit inside an element.
  7. 7CSS Z-indexThe CSS Z-index property controls the stacking order of positioned elements on a webpage.
  8. 8Intrinsic SizingUse min-content, max-content, fit-content(), and flexible track sizing to let content participate in layout decisions. It covers min-content, max-content, fit-content(), minmax(), flexible Grid tracks, and content-driven layouts that need fewer breakpoints.
  9. 9Aspect Ratio & Object FitReserve stable media space with aspect-ratio and control how images and video fit and align inside their boxes. You will reserve stable media space and compare cover, contain, fill, scale-down, and object-position for images and video.
  10. 10Multi-column LayoutFlow long-form content through balanced columns and control how elements break across them. The examples cover automatic column count, preferred column width, column rules, spanning headings, and fragmentation controls.