Comment

Comment by moritzwarhier

But flex layout is fundamentally different from tables, I guess you meant grid with that reference?

It's not that every website uses CSS grid for layout.

Coincidentally, I took a look at the DOM+CSS of a bluesky post just a few days ago (very weird coincidence, since that was the first time I opned bluesky for months), and it did use old-school tricks like centering using CSS transforms, presumably because renders a tiny bit faster than flex centering, or avoids layout calculations when elements are added in a virtualized list.

Virtualized lists are also a good example for falling back to specifying exact pixel positions and dimensions for performance reasons, but these are usually determined with help of JS. I think the transform I saw was a translateX(-50%) one, so centering.

I totally get the canvas-like approach, but in a way the constraint-based flex layouts fall into the same line of thinking for me.

The issue with absolute positioning is the need to manually specify positions and dimensions for elements, which makes it useless unless you are working within a fixed box or only relating to the corners of one rectangle.

It is explicitly meant to remove elements from the normal layout flow so they overlap each other by default.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton