Hacker News new | ask | show | jobs
by otabdeveloper2 2327 days ago
> Still, it was better than tables.

Well, no. Nothing wrong at all with tables.

2 comments

Yes and no, but there is some confusion due to terminology.

There are HTML tables, created with the <table> tag, and then there are CSS layout tables created with the "display:table" property. Neither are inherently good or bad, it is just a question of when they are appropriate.

The problem with tables back in the day was that browsers didn't support "display:table", so the only way to get a grid-like layout was to use the <table>-tag. In cases when the content wasn't semantically a table, you had a dilemma. Either you would have to abuse the <table> tag thereby hurting accessibility, or you would have to use CSS floats and hacks to achieve the desired grid-like effect. Neither was really desirable.

Today we have "display:table", but we also have flexbox and grid which is are much more powerful, so the use of tables-for-layout are mostly irrelevant.

> browsers didn't support "display:table"

Internet Explorer on Windows was the singular offender. ISTR that other ones with at least 0.7% market share were implementing the display property correctly.

A desirable solution was to just paper over the bugs and other shortcomings with Javascript: https://github.com/seancoyne/ie7-js

That way one could simply write standard compliant code and not waste any time with hacks and float work-arounds.

"Internet Explorer on Windows was"... 90% plus of the market
The trick I did was “<!--[if lt IE 8]><table><![endif]-->” for older IE and “display: table” for anything standards compliant.
> In cases when the content wasn't semantically a table, you had a dilemma.

If you have text that's laid out with a fixed number of columns and a dynamic number of rows, than what you have is exactly a table.

Absolutely no reason to get your underwear in a bunch in a rage of hipster semantic pseudo-purity just because it's not literally a table of Excel figures.

HTML Tables does not support a dynamic number of rows. But you can do that with CSS grid.
Unless you depend on screen reader support. Table-based layout (as this is what you are quoting) is inaccessible.