Hacker News new | ask | show | jobs
by htrwaway73 1378 days ago
Seems like modern web developers don't use tables as much as they should. I blame the "missing generation" for this. Tables used for layout was considered so bad, that many stopped using tables for tabular data.

To explain more, consider this evolution of tables based for layout

1. Early 90s/2000s: Tables used for layout as no good alternatives were available

2. The "popular" kids hated tables for layout and tried to use floats etc. A 3 column layout using floats was considered "the holy grail", because it was so hard to get it to work. Most developers continued using tables until Bootstrap and other frameworks managed to take some of the pain away

3. Flexbox is introduced as an alternative to floats, but with its own issues.

4. CSS grids are finally here, after only 30 years of waiting for it and we can finally get a 3 column layout working without too much dark magic.

To me it seems that they years between 2 and 3 was kind of "lost", where developers got the impression that tables were bad even for tabular data. I have seen so many developers display tables as a collection of divs, or just giving up and using a picture of a table instead. The losers are of course accessibility and the semantic web.

Now it seem developers are rediscovering tables due to the superior accessibility they provide and they are "allowed" by the hipsters to actually use tables for tabular data again.

Next step: Maybe realize that there are other tags than h1 and div? One can only dream.

3 comments

Mobile view of tables is the worst, since they almost always horizontally overflow the narrow screens. I suggest that's another reason tabular non-tables have stuck around.

Nowdays, with `display: contents` (on the tbody/tr) you can use `display: grid` to do the layout for your table, too, making it easier to make the table responsive.

CSS lets you do other fun things to tables, too. For example https://ffoodd.github.io/chaarts/pie-charts.html uses tables, but does not display like a table.

Wouldn't table markup be the correct semantic designator for tabular data? Plus the plugins that work with tables, the ease of copying tables from the screen to spreadsheets, that screen readers know what tables are, etc.
Yeah, I'm not saying don't use tables. Do use tables, they're great for accessibility, but don't feel tied to using table layout; CSS has some great alternatives now that preserve the HTML structure of the table, but display it differently.
Have you ever done a 'View Source' on the HN comments page?
> 2. The "popular" kids hated tables for layout and tried to use floats etc. A 3 column layout using floats was considered "the holy grail", because it was so hard to get it to work. Most developers continued using tables until Bootstrap and other frameworks managed to take some of the pain away

Ha ha ha! Yeah, in hindsight I should have skipped this "right way" bandwagon and stuck with tables until this phase was over. I wasted a lot more time screwing around with "float" than I did fixing up table layouts. Even if it would have made me significantly less cool.

The css alternative to <table> was display:table which have existed for ages.