Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

> It’s like the designers didn’t even think about layout because that problem was already solved with HTML tables. But the problem was that when CSS came out there it came with the mantra of thou shalt not use tables for layout

This is an unfortunate misunderstanding. CSS did initially aim to provide at least same expressive power as presentational HTML allowed at the time. So it provided the display:table layout model so designers didn't have to use HTML tables for layout. Unfortunately Internet Explorer (which was dominant at the time) did not support this property for a very long time.

Floats were never intended as a general purpose layout tool, but ended up like that for designers which wanted to use pure CSS but at the same time had to cater to IE users.

While flexbox and flexgrid are more powerful and flexible, display:table actually support a lot of the layout functionality designers were clamoring for, like easy to implement expanding sidebars and such. The problem was not with the CSS spec but with the lack of support in the dominant browser.



view as:

display:table; doesn't actually replace table based layouts though, because it can't do colspan/rowspan, even today. Ran into this when trying to make a table (containing actual tabular data) responsive

display:table is the holy grail

Not even kidding, flexboxes and grids still have problems and can display differently depending on the browser (version), sometimes overflowing.

display:table is the holy grail for layouts - it's very easy to write and understand and it looks same everywhere, even going back to IE11.

display:table is the holy grail for tables - now you can have a clickable row without javascript


Legal | privacy