Hacker News new | ask | show | jobs
by sodapopcan 1041 days ago
Ah, cellpadding and cellspacing. A blast from the past!
1 comments

Wait, there is something newer now?
This year every credible CSS expert is using grid-item-gutter-closed-start specified in qem units. Last year it was flex-interval-bound-distance: 1, auto, 100% but the spacing wasn’t artisanal enough. Many people are also discovering the Tailwind organic vintage where you just add sx-dff-7 gb-y it-9-em on all your elements.
I legitimately cannot tell if this is satire
what a waste of time lol
CSS padding and border-spacing properties can be used instead (they recommend using CSS).

The cellpadding [0] and cellspacing [1] attributes are still supported but deprecated. I'm impressed by the usage numbers, though. I do not believe this will be removed from browsers anytime soon, but that's just my opinion.

[0]: https://caniuse.com/mdn-html_elements_table_cellpadding

[1]: https://caniuse.com/mdn-html_elements_table_cellspacing

Tables first came to be used as a tool for general page layout because IE 5's box model sucked so bad nothing else really worked.

It has been a minute since that constraint applied, yeah.

IE5's box model was the good one (* { box-sizing: border-box; } is the vestigial "please use the IE box model" in almost every CSS file today). It was Netscape/early Mozilla's box model that was hard to reason with.

But also, using Tables for page layout had less to do with box layout problems and more to do with the lack of something like CSS Grid (finally, decades later). Tables let you define regular grids in a way that was closer to designing a grid (thinking in terms of spans across cells instead of widths/margins). Tables for layout didn't truly go away until around the Bootstrap era with its column grid helpers (and their complex CSS math to make that work before both flexbox and native CSS Grid).

As a Firefox partisan since back when it was still Phoenix, of course I'd argue it was IE 5's box model that sucked. But the real problem is that there wasn't one box model that behaved identically across all the popular implementations.
The old Netscape/Phoenix/Firefox box model had borders take up half-inside half-outside and doing any sort of math with it and getting things to align at all was terrible effort in CSS.

I love Firefox to this day, but mathematically the choices that box model made made sense as easier on the renderer but was awful to work with for the web developer.

It's great that we have the choice between box models today and their behavior is better standardized. I know if you surveyed CSS in the wild you'd find most CSS is written for the IE box model (border-box) and yet it is funny that that is the one you have to opt-in to because that adds to the overall impression that CSS by default is broken and needs reset stylesheets and boilerplate.

Tables first came to be used for displaying tabular (spreadsheet-like) data – which was what it was designed for.

And for that purpose, it's still the best option.

Yes, that's why they're in the spec and is the case where their use is still valid, but that's why I qualified my prior comment.

HN dates from the period I described and still uses tables for general page layout, hence the original commenter's query to which I replied.

> HN dates from the period I described and still uses tables for general page layout

According to Wiki HN dates from 2007. I think Yahoo moved from table to CSS layout earlier. CSS Zen Garden is from around 2003.

All true, but the point at which web dev more generally moved to CSS over tables was considerably later, not least because early CSS was pretty hard to find resources on and work effectively with. Firebug helped a lot from 2005 on, as of course also the browser-native devtools it inspired, but in 2007 it remained far from a surprise to see sites built in what was then still a current, if not the latest, style.
The validator says to use something called "CSS" instead.
Grid replaced table
Tables are still in the HTML spec. Not really practical to represent tabular data with grid layout.
But also not practical to do page layouts with tables.
It’s how we did it it in the 90’s, also I think it still worked better than the alternatives until we got grid and flexbox.