What tables were actually for

More than twenty years ago, tables were the primary means of constructing HTML pages. They gave builders consistent control over layout, and pages no longer had to run strictly top-to-bottom: content could be arranged into columns that aligned both left-to-right and top-to-bottom. At the time, that was a genuine breakthrough.

The trouble is that tables were never designed for page layout. Using them that way was a convenient hack, and a welcome one for anyone chasing a very specific layout that earlier approaches could not handle, but it carried well-documented problems that are obvious in hindsight.

Where table-based layout breaks down

Accessibility tops the list. The <table>, <th>, <tr> and <td> elements are not especially accessible when nested several levels deep, and screen readers struggle to parse them into cohesive blocks of content. That is not an indictment of tables as elements; they simply were never intended as a layout mechanism. A page that looks like a typical site layout but is built solely from a table shows how quickly the markup becomes bloated and inaccessible once a table is used for anything other than tabular data.

The case for keeping tables

After two decades of abuse, it is tempting to avoid tables entirely — many developers carry unkind war stories from shipping table-based layouts. But that reputation is not entirely fair. Tables serve a real purpose, and they are accessible when used correctly.

They exist to handle data that is semantically related and best presented in a linear-like format. Tables remain a legitimate choice in 2020 and will likely stay one for years to come, provided they hold tabular data and nothing else.

What floats were designed to do

The push toward web standards in the early 2000s moved tables aside as a layout solution in favor of other approaches, most notably the CSS float property. For the first time there was a true separation of concerns: markup did the markup job, CSS did the visual job. Code became cleaner and easier to maintain, freeing teams to focus on standards such as accessibility and on practices like SEO.

Floats were originally designed so that content flows around images floated left or right while staying in the document flow. Once newer layout features arrived, floats fell by the wayside too — partly because better tools exist, and partly because they earned the same bad reputation as tables after being misused for a long time.

Yet floats remain useful and relevant. The shape-outside property, for instance, will not work without them. A legitimate use case is simply wrapping content around a styled <blockquote>.

Modern layout still leads

Grid, flexbox and multicolumn layouts are among the best tools available today. They offer more layout possibilities and produce cleaner, more accessible code, and they will remain the go-to approaches for many years. The same layout discussed here takes no hacks and no extra code with flexbox.

Reach for the right tool

When a situation matches the intended use of a table or a float, reach for it with confidence. The point is not renewed enthusiasm for either technique, but recognition that, used correctly, both are perfectly valid and remain indispensable parts of the overall toolset.