Hi all. There are many articles out there reminding us that Flexbox isn’t dead because of the advent of Grid. They are both tools in our toolbox that have essentially different purposes, even though there’s some overlap in what they can do.
I’ve been wondering lately about CSS Table layout, though. It’s another tool, but I’m struggling to think of something it can do that can’t be done (probably better) by Grid. Each time I think of something Table layout might be better at, I find a simple way to do it in Grid.
It’s funny that there’s basically no info online about CSS Table layout any more — even in some of the big CSS references like MDN. It’s like it’s disappeared off the map. Even if you google “Is CSS Table layout dead?”, nothing comes up (at least that I could find).
So I’m really here to discuss this, and see if anyone can come up with a use case where CSS Tables can do something better than Grid. Or should we just try to forget that CSS Table layout ever existed?
(Note to those who’ve never heard of CSS Table layout: it’s not the same as HTML table layout. CSS Table layout was an attempt to wean us off HTML table layout, so that we could use semantic HTML and still have complex, grid-like layouts. It was quite revolutionary in its day, and finally came into its own — to some extent — once it was supported in IE8. But it never really took off like Grid has. It was best suited, it seems, to certain elements within a layout than for doing an entire layout, although it was perfectly capable of doing that.)
Here’s the actual specification, and the CSS CSS Box Alignment Module Level 3 mentions table layout throughout, along with Flex, Grid and normal block layout. It’s interesting to compare properties that apply to
display: table and those that apply to
grid, and which they occasionally share.
Table layout won’t be removed from CSS, of course (as it always aims to be backwards-compatible), but my question still stands: is there really anything CSS table layout can do either better than Flexbox or Grid, or that they can’t do at all?