5 ms·
CSS never recommended float/clear as an alternative to table-based layout. CSS had ‘display:table’ for when you needed a tabular layout without the semantic bag
by bazoom42 3y ago
CSS never recommended float/clear as an alternative to table-based layout. CSS had ‘display:table’ for when you needed a tabular layout without the semantic baggage of the table-tag.
- thejohnconway 3y ago"CSS" (not sure what you're referring to here, the standards bodies?). Endless articles from the mid 2000s kept saying tables bad, here's how you layout without tables. All of them used floats for layout, not display:table. Partly I suppose this was because IE didn't support it until 2009, I think. Nearly all layouts people actually want are table-like, and I think CSS really was misguided in its text-flow as layout approach.
- winternewt 3y agoThe reason for the advice against tables was that the "semantic web" was all the rage (probably mostly because Google wanted to make it easier to index stuff). If you have tabular data, using tables was just fine. The issue was with using it solely to control the graphical presentation without any semantic basis for putting it in the table. Same reason you don't use <H1> just to make the text bigger.
- coldtea 3y ago>The issue was with using it solely to control the graphical presentation without any semantic basis for putting it in the table. There shouldn't be any semantic basis needed. HTML is not a semantic data exchange format, was not designed to be (the pathetic handful of semantic HTML5 tags added to be used ad-hoc included), and it inevitably includes content, style, and behavior (js). The semantics should belong to data intergchanged (and storage format), and the reusability should be on the data storage/query backend, not to the markup language. Adding semantics to the markup duplicates the semantics already present in your DB or JSON API scheme or query server/storage in general.
- bazoom42 3y agoSemantic markup is what makes both web crawlers and screen readers recognize that <a href> is a link to another URL. The web couldnt work without it.
- bazoom42 3y agoYeah there was a period of time when IE didnt support display:table and ARIA hints wasnt as developed. So if you wanted to create accessible web sites with nice layout you had to resort to weird hacks, often using floats. Floats was never intended for that purpose though, it was just a desperate hack to get around IE limitations. But html tables was not a viable alternative for organizations which was required to have accessible websites. (Today I believe it is possible to create accissible html tables through ARIA hints, but that was not an option at the time.)
- bazoom42 3y ago> Nearly all layouts people actually want are table-like, and I think CSS really was misguided in its text-flow as layout approach. I think this is the core misunderstanding in this discussion. CSS 2 supported both text-flow and tabular layout and both layout models were reverse-ingeneered from how Netscape rendered HTML. There is this weird idea that CSS is somehow opposed to tables or tabular layout, while a significant part of CSS2 is actually the codification of how tables render.
- thejohnconway 3y agoI don’t think there’s much of a misunderstanding here. There are historical reasons why CSS was so weak on layout for so long, but there’s always reasons. To understand what was missing look at what they’ve added (flexbox and grid). I don’t like the implementation of either, but they are in the right space.
- deleted 3y ago[deleted]
- coldtea 3y agoCSS is just a language + words of paper spec. CSS, as in "CSS evangelists", influential web designers, guidelines in web development resources, books, and so on, recommended and advocated for the use of clear/float. You might not have been there, but float layout was a big thing back then, and everybody was guilt-pressured to use that - neither tables, nor "display: table" (which was used by some, but also discouraged).
- JimDabell 3y agoI never saw anybody discourage people from using display: table. The reason why nobody used it was because Internet Explorer 6 didn’t support it.
- bazoom42 3y agoYou are probably remembering advice from the dark age of IE6 dominance where display:table was not well supported. I have also seen advice againt using html tables in the early days of mobile browsers since they handled them badly. The problem is people forget context. The advice “dont use tables <in this specific context under these specific constraints>” is remembered as “tables are bad, never use tables or anything which remotely looks like a table”.
- ajmurmann 3y ago'display: table' wasn't consistently supported and '<table>' for layout caused issues for screen readers because they (rightfully) expected content that's tabular in nature.
- davedx 3y ago> everybody was guilt-pressured What, no? I did a lot of web development in those days and read a lot of blogs. You just needed to filter out anyone who was obviously over-opinionated and lacked any nuance. Most pragmatic people used tables and didn't feel guilty about it. If you delivered working software with a decent UX, why on earth would you care what some shouty internet person said??
- bazoom42 3y ago