HTML and CSS have evolved a degree of flexibility that means that even conceptually "block" elements like <div>
(HTML's oldest and most general form of block content) don't need to be displayed as blocks:
div { display: inline; }
As you note, <div>
can be repurposed to emulate <table>
and its fellow travelers. Actually, most tags can. Given their special roles, I doubt you could usefully remap macro tags like <html>
, <head>
, <body>
, and <script>
, but "common" tags like <div>
, <p>
, <b>
, <em>
, <span>
, and <pre>
? Up for grabs. Make the inline tags blocks, the blocks inline, the pre-formatted tags flow, the stationary ones float. Go crazy, if you like!
It's possible. You may want to spin a yarn about how we should all use "semantic markup" blah blah blah, or believe with the Pythonistas that "There should be one--and preferably only one--obvious way to do it." Yet Tim Toady is a clever and curious guy. Given a free hand, he'll explore them all. That includes using the available flexibility to make substitutions. Some are wise, some will be proven otherwise. But trial, error, and experience is the only way to find that out. So the sufficient conditions for substitution are present.
I don't think it's overstepping to say that substitution is also necessary. At minimum, it's extremely convenient. For a long time, HTML didn't have <menu>
, <section>
, or <aside>
elements. Yet web pages and apps everywhere have menus, sections, and sidebars. How? Because HTML list elements (<ul>
, <ol>
, and <li>
) were easily repurposed and some usages re-classified as menu containers and parts. <div>
could stand in for <article>
, <section>
, <aside>
, <figure>
, and <summary>
. HTML5 has caught up with, and added bespoke elements for, some previously-unaddressed use cases. It's a great update and correction to accommodate common, real-world use.
Even so, there remain a lot of common idioms that don't have bespoke tags or semantic models. Things like pages, footnotes, pull-quotes, comment streams, associated avatars, "likes," subheads, and subtitles that I and many others use every day. What are we to do? What we can. Repurpose "close but inexact" elements with classes and ids to stand in and support our work for the next five or ten or however many years until HTML6 or HTML7 catches up. HTML/CSS's "yes, it's an X, in theory, but we're going to tag it and work with it as a Y" ability is incredibly convenient. Indispensable, really. It makes Web content flex, and not be brittle.
Going even further, "semantic markup" has irreducible limitations. That's true of any kind of rigorous structure you can imagine for content.
Standard formats cannot encompass the entire wealth of human need, desire, and variety. They will always will be "behind the curve" of what people are doing now. How they are innovating. Heck, HTML5 is still behind the curve on footnotes, subheads, and other printing innovations of the 17th century. It lacks features essential to many information workers and content creators. So we improvise.
Even more unchanging is that information doesn't abide by one set of rules. Sure, it starts as a table. But maybe you just want the summary--say the title for each row, as a list. Maybe it takes up too much space, and you'd like it as a space-saving inline list. Maybe you have records you just want the title of, then if you click, you see the underlying details. Or you want items in a complex list or table to be grouped and categorized. Oh, now you want it transposed and categorized a different way. Or the values plotted as a bar chart. These are things done every day in apps, spreadsheets, and data visualization. They are part and parcel of our information landscape, and what we want and need to do on the web. Humans constantly reorganize the form and presentation of our data. It isn't just one thing, or one format/layout, or one concept. It's fungible, with semantics depending on the circumstance and on choices users make interactively. Yes, mark text as "emphasized" (<em>
), but that's just a convention. I've worked on documents with at least a half-dozen different kinds of "emphasis." We need to be able to customize and remap that for different uses, different interpretations. One kind of HTML emphasis? Excruciatingly reductionistic. Limiting. Brittle. The same is true for <table>
, <p>
, etc.
It's great to have tags/elements that help organize the entire community's thinking about "what goes where." That helps establish conventions and idioms, and makes us collectively more efficient. But the ability to remap things, to redesignate and repurpose those structures? That's part and parcel of the Web's inclusiveness and its success.
table-layout:fixed
, it will need to load entirely before it can be displayed. With modern broadband this effect is simply less noticeable.