Back to lessons
Scrollytelling

CSS Evolution

From tables to modern CSS

A History of Layout

CSS layout has undergone a dramatic evolution. What started as a simple styling language has become a powerful layout system. Each era solved problems but introduced new ones — until modern CSS finally gave us the tools we needed.

  CSS Layout Timeline
  ──────────────────────────────
  1996  CSS1 — basic styling
  1998  CSS2 — positioning, floats
  2000s Table layouts everywhere
  2010s Float-based frameworks (Bootstrap)
  2012  Flexbox specification
  2017  CSS Grid specification
  2020s Container queries, :has(), layers
  ──────────────────────────────

The Table Era (1996–2005)

Before CSS had proper layout tools, developers used HTML <table> elements to create page layouts. Tables were designed for tabular data, but they were the only reliable way to create multi-column layouts.

  Table Layout Problems:
  ──────────────────────────────
  ✗ Semantically wrong (layout ≠ data)
  ✗ Inaccessible to screen readers
  ✗ Rigid, hard to make responsive
  ✗ Deeply nested HTML (table > tr > td)
  ✗ Mixing structure and presentation
  ──────────────────────────────

The Float Era (2005–2015)

CSS float was designed for wrapping text around images, but developers repurposed it for layouts. This worked but required hacks like clearfix, negative margins, and careful calculations.

  Float Layout Problems:
  ──────────────────────────────
  ✗ Clearfix hacks required
  ✗ No vertical centering
  ✗ Column heights don't match
  ✗ Source order = visual order
  ✗ Fragile percentage calculations
  ──────────────────────────────

  The era of "just add clearfix" and
  "why is my layout broken?"

CSS frameworks like Bootstrap emerged during this era, providing pre-built float-based grid systems. They solved the immediate problem but added significant CSS bloat.

Flexbox & Grid (2015–present)

Flexbox (2012) and CSS Grid (2017) were the first CSS features designed specifically for layout. They solved decades of layout frustrations in clean, intuitive ways.

  What Flexbox & Grid solved:
  ──────────────────────────────
  ✓ Vertical centering (finally!)
  ✓ Equal-height columns
  ✓ Reorder without changing HTML
  ✓ Space distribution (gap)
  ✓ Two-dimensional layouts (Grid)
  ✓ Named grid areas
  ✓ No clearfix needed
  ──────────────────────────────

Modern CSS (2020s)

CSS continues to evolve rapidly. Recent additions have made CSS more powerful than ever, reducing the need for JavaScript and preprocessors.

  Modern CSS Features:
  ──────────────────────────────
  Container queries    — style based on parent size
  :has() selector      — parent selector (finally!)
  CSS Nesting          — native nesting without Sass
  @layer               — explicit cascade control
  CSS Variables        — dynamic theming
  subgrid              — nested grid alignment
  oklch()              — perceptually uniform colors
  view-transitions     — page transition animations
  anchor positioning   — position relative to any element
  ──────────────────────────────

Summary

From hacks to purpose-built tools

Tables and floats were never meant for layout. Flexbox and Grid were designed specifically for it, making layouts simpler and more maintainable.

CSS keeps getting better

Container queries, nesting, and cascade layers are making CSS more powerful every year. Many things that once required JavaScript or preprocessors are now native CSS.