liveBook · Manning

Fluid layout

As explained in Web Design Playground

A responsive page layout approach in which horizontal dimensions are expressed with relative units so content expands or contracts with the viewport.

A fluid layout lets a page expand and contract with the screen instead of locking its pieces to fixed pixel widths. It is also called a liquid layout. Think of it like a stretchy tablecloth: the shape stays useful as the table changes size. section 13.5 section 13.0

Convert a fixed layout in three friendly steps:

  • Choose a maximum width for the outer container. This keeps large-screen text from stretching into uncomfortable, extra-long lines. section 13.5
  • Replace fixed widths with percentages. A child set to 75% occupies three quarters of its parent, not three quarters of the viewport. section 13.5
  • Check smaller screens. Flexible columns may fit without horizontal scrolling but become too narrow to read comfortably. section 13.7
body {
    max-width: 960px;
}

A maximum width gives the layout room to shrink while preventing it from becoming excessively wide on large screens. section 13.5

element percentage = (element fixed width / parent fixed width) * 100

Convert each fixed child width by dividing it by its fixed parent width and multiplying by 100. section 13.5

A quick conversion

If a child was 750 pixels wide inside a 1,000-pixel parent, use width: 75%. When the parent shrinks to 800 pixels, the child becomes 600 pixels wide automatically. Try converting a small page in the Playground, then inspect it on a tablet and smartphone-sized screen. section 13.5 section 13.7

How Web Design Playground covers it

How deep it goes
Explains maximum widths, parent-based percentages, conversion calculations, and the narrow-column limitation before responsive refinements.
Examples
Uses a 960-pixel maximum container, a 75-percent child calculation, device-size comparisons, and a Playground conversion exercise.
What it assumes
Assumes basic CSS width knowledge while teaching the difference between fixed measurements, relative percentages, and parent dimensions.
What you can do after
Build it from scratch by replacing fixed widths with parent-relative percentages and applying a sensible maximum width.
How it connects
Connects liquid layouts with fixed-width layouts, responsive web design, flexbox, inline blocks, media queries, and mobile-first design.

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 Web Design Playground. The section links point to the parts of the book it draws on.