liveBook · Manning

Fluid layout

As explained in Math for Web Design

A fluid layout is a web layout whose dimensions and spacing adjust continuously as the available viewport size changes.

A fluid layout replaces rigid pixel widths with relationships that respond continuously to available space. It avoids horizontal scrolling on narrow screens and sudden breakpoint-driven jumps, while a max-width prevents comfortable reading areas from becoming too wide. section 6.3.4 section 6.5.1

Convert a fixed layout to a percentage-based fluid layout in three practical steps:

  • Set a maximum width on the outer container, such as max-width: 960px, so larger screens do not produce excessively long text lines. section 6.3.4
  • Convert each narrower child width with element percentage = (element fixed width / parent fixed width) * 100. section 6.3.4
  • Apply the same percentage-based reasoning to related spacing, including margins and padding; horizontal and vertical percentages are relative to the parent width. section 6.7

From fixed columns to fluid columns

A 640px article beside a 320px aside inside a 960px layout becomes approximately 66.67% and 33.33%. As the parent changes from 1,000px to 800px, a 75% child changes from 750px to 600px automatically. CSS can express the result with body { max-width: 960px; }, article { width: 66.67%; }, and aside { width: 33.33%; }.

How Math for Web Design covers it

How deep it goes
Explains the three-stage conversion from fixed dimensions through percentage calculations to responsive CSS implementation.
Examples
Demonstrates fixed and liquid article-aside layouts using 960px containers, percentage columns, padding, and parent-child width calculations.
What it assumes
Assumes fixed-width CSS and parent-child sizing, then teaches percentage conversion and responsive layout decisions.
What you can do after
Build it from scratch by choosing a maximum width, converting child dimensions to percentages, and scaling related spacing.
How it connects
Connects fluid layouts with responsive design, breakpoints, media queries, Grid, Flexbox, CSS math functions, and viewport units.

Also explained in

Compare how 3 books explain fluid layout →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math for Web Design. The section links point to the parts of the book it draws on.