Hacker News new | ask | show | jobs
by omribahumi 2952 days ago
I don’t write client side browser code these days any more, but when I did back in the 2000s, I remember people bashing using tables for layout, and how everyone should switch to CSS.

From quick googling of what CSS Grid Layout is, seems to be like we’re back to using tables, we just offload it to the style sheet.

5 comments

I've mostly been a frontend dev since the late 1990s. CSS Grid does feel like building with tables in some respects. You don't suffer the problems tables had though, like the close coupling of layout to HTML, the necessity to have a tag for every cell, the rigid order of cells, or the spacer gifs to stop things collapsing. CSS Grid gives you the formality of a proper grid system with some really nice features for spacing, placement and ordering the content. Plus, in Grid, cells can overlap with other cells, so it's fairly easy to make some really clever designs that look great. It's been very well thought out, and it works.

I really wouldn't want to go back to even plain Flexbox now, let alone floating elements, tables, or any other layout system.

The tables bashing was because it resulted in tag soup, even though it was conceptually easy.

This doesn't suffer from the same problem.

The tables bashing was because of the common view that CSS and HTML, the styling and markup, should be separated. It wasn't due to tag bloat, which has remained common with HTML regardless (we still have a million div tags in the place of table/td/tr).

<table> is a rigid display value taking up an entire tag. So the argument is why not push that into the CSS eg in a div instead and get rid of an entire unnecessary tag. This is why display:table doesn't get the same kind of hate thrown at it that <table> does.

So in effect it was fashion mixed with politics disguised as a technical discussion...
Tables are not 'tag soup'.
10 tables to display 1 header, 1 footer, 2 lines of text and 1 image in an email is 'tag soup'.
“Tag soup” doesn’t mean “bad markup”. It specifically refers to when you write HTML as a series of commands and the result is a bunch of tags that aren’t nested properly and don’t result in a tree structure. Things like <b><i>…</b></i>.
So they should’ve added new tags for layout, instead of table,tr,td,th ?

Much like yield vs await in Python3 asyncio.

In the Python 2.7 days, people used generator functions to implement async in Python. When Python3 first came out, you couldn’t do both generator and async in the same function. I assume it’s because they used the same mechanism internally.

I think it was Python 3.5 which added support for async generators.

I don't believe python 2.7 could ever do async. Async was only possible in 3.3 when `yield from` landed and then was bastardized into coroutines through decorators.

3.5 released true asnyc/await based on the `yield from` form and then 3.6 allowed for async generators.

You were close and your point remains. Although I don't think new tags are the right choice. I think HTML learnt a while ago that more tags doesn't solve everything.

I do really enjoy python async. It's cool to see a feature develop from a hack like that but a language first approach could have avoided some headaches. This is where Grid wins, it's a fresh take without requiring to maintain backwards compatibility with previous attempts.

I think the philosophical difference is meant to be that in HTML tables the layout was part of the markup (and so had -- or should have had -- semantic meaning) whereas with CSS Grid the table layout is part of the styling. This is alluded to in TFA's section on accessibility.

For devs who don't care so much about accessibility, and are more just interested in getting the layout they want, I guess that argument may not resonate so much. I personally don't care much for taxonomic/teleological arguments around REST methods, but I'm a bit more willing to follow fashion with Grid if it means people on screen-readers will have a better time.

No, it is not the same. You should at least try it out before you make blanket statements like that.
<table> is not grid. <table> is a fixed container. grid does not. <table> is HTML. grid is CSS. The structure does not change when using CSS.
> back in the 2000s, I remember people bashing using tables for layout, and how everyone should switch to CSS.

> seems to be like we’re back to using tables, we just offload it to the style sheet.

which solves exactly the issue that people were "bashing" about.