← Back to context

Comment by dwb

3 days ago

A table is for tabulating data. They have quite different meaning and purpose, even if they share a couple of characteristics.

Tabulate means to organize by rows and columns.

Layout grids organize data by rows and columns.

  • They don't! Layout grids are less about the rows and columns and more about the lines separating them (which is why those get a lot of attention in CSS grid). Take a look at how layout grids are used in design and you will quickly find examples that are extremely inconvenient to realize with HTML tables. I'm sure it can be done and I'm sure some poor email marketing dev had to, but the result would be entirely static and not able to reflow.

  • You have just restated the similarity I referred to. The ways they are different make them important enough to distinguish.

    “Tabulate” doesn’t just mean organising anything by rows and columns, it means organising data for a particular purpose. And layout grids usually end up looking quite different to tables because although they have a broadly similar underlying structure, the purpose is quite different.

HTML spec couldn’t just have added a grid element?

  • CSS grids are for presentation, HTML is for semantics. Ideally they are separated. That's why the use of <center> tag is deprecated.

  • I think CSS grid is too powerful to be represented in markup. I rotated the idea in my head for a bit but the most I could come up was elements that covered a small subset of CSS grid and which completely lost the entire appeal of being able to handle tracks dynamically.

    • This is a classic problem I identify across a wide variety of types of software. I call it "forcing a graph into a tree" and it comes up any time you have something that must be evaluated across multiple axises but the earliest assumptions (now invalidated) about the data restricted it to a tree, or the most really available tools to process it is with tree-like data structures and algorithms.

      HTML is a tree. It's really great at trees. But defining a grid layout sometimes requires organizing data by both the rows and the columns. That can't fit into a tree.

      I think a lot of people's complaints that "CSS is too complex, why can't we just do this in HTML" would go away if they could understand that CSS--being a rules-based system--can process the graph, but HTML can only ever define a tree. There are things that will just never work in just HTML.

      This gets hard because trees are easy for people to understand. We have lots of examples of them: file systems (if you ignore symlinks). Family trees (if you ignore inbreeding). Tree of life taxonomies (if you ignore more than basic undergrad biology). You can probably guess by my caveats how much I feel it is important to study graphs. But graphs are "scary Computer Science" stuff to a lot of people, so they don't take the time to learn.