Live data from Hacker News

Hardest problem in computer science: centering things

tonsky.me

261–270 of 473 posts

Re: Hardest problem in computer science: centering things

#262

Earlier quoted context omitted.

There is always a lot of confusion about this because “tables” can mean different things - it is both a set of structual elements in HTML and a layout model in CSS. CSS is “the right way” to control styling and layout, but that does not mean you can’t use tables. In the early days of the web people used the BLOCKQUOTE element to create margins since this was the only way. When CSS arrived, it became “the right way” t…

But that is the point. CSS arrived, and people started saying you "just need to distinguish beteen the semantics of" a table "and the layout effect". Back then, the chant of the day was, "blood for the blood god, tabular data for the god, layout for the CSS god". And then it spiraled into general "separation of content and presentation" nonsense that, like in any good cult, people believed with their whole hearts, pr…

Is accessibility for the visually impaired a cult? How could Google even work if content could not be seperated from its visual presention?

Re: Hardest problem in computer science: centering things

#263
post #4

Is the author here? Can you give us a toggle so we can turn off the moving cursors? It's a little distracting. Reader mode isn't working so well, so I deleted the element in developer tools in the mean time.

There is such toggle that makes it disabled by default. It is called NoScript.

Re: Hardest problem in computer science: centering things

#264
post #261

Why do you need to remember four words instead of just `horizontal`/`vertical`? Why did `justify-content` became `justify-items`?

Because `flex-direction` exists, which means that horizontal and vertical are contextually meaningless. https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direct...

I don't agree with the inconsistent naming across the axes, however horizontal/vertical isn't the answer to it.

Re: Hardest problem in computer science: centering things

#265

Earlier quoted context omitted.

It is a weird myth that CSS somehow discourages tables. CSS have supported styling html tables and ‘display:table’ (allowing a table-like layout without html-tables) for 25 years. Float and clear was grandfathered into CSS since they were added to HTML by Netscape. They are fine for their intended purpose: placing images in a text and have the text flow around. Other positioning systems you mention does not solve the…

> It is a weird myth that CSS somehow discourages tables. CSS have supported styling html tables and ‘display:table’ (allowing a table-like layout without html-tables) for 25 years. Not a myth in any way shape or form. Tables for layout (not tables in general) were discouraged with various arguments in favor of "float/clear", even decades before a sane substitute (grid/flex) was available. > Other positioning systems…

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.

Re: Hardest problem in computer science: centering things

#266
post #98

Don't read this article, if you are not in web dev. Once you start seeing it, you can't stop seeing it, and it will drive you crazy forever. It is the same for noticing misalignment, recognizing color oversaturation, high quality speakers/headphones, etc. (It is a good article!)

The same happens when you: - Install flooring - Install trim in your own home - Build / install cabinets You will now see: - Odd flooring patterns and uneven floors - Know what it looks like when trim isn't coped - Uneven gaps between doors

This is what causes me absolute task initiation paralysis - the fear of not being perfect - even with my new attempt at adherence to "don't let perfection be the enemy of good enough"

Does anyone else who comes into the house notice anything? Very unlikely unless they are craftspeople.

Re: Hardest problem in computer science: centering things

#267

This is an excellent piece, about how virtually impossible it is to center things accurately mostly because of how fonts are displayed. But I'll add two more wrinkles that the author doesn't mention: First, that font rendering isn't just about metrics but varies across operating systems and browsers. So even if you center perfectly on Chrome on your Mac, it may very well be off on Firefox on Windows. And second, that…

Yes, and let’s not forget fallback fonts. So rules for each browser and OS and each font class and each layout (desktop, tablet, mobile). Probably on the order of 100 rules for a single style. Yeah, we’re just being lazy. We need sane font rendering in browsers that treat things like alignment in a way that we’d expect for the 99% case. If I say “center” it should just fucking center.

That’s not true though. You don’t need different styles for text on different platfroms. They all work the same

Re: Hardest problem in computer science: centering things

#268

> (also don’t ask why justify-content became justify-items) It didn't. `justify-content` works with grid too, and will bunch all the grid cells into the center. `justify-items` is if you want the contents of each grid cell to be centered. Also, `place-content` or `place-items` for grid does both the horizontal & vertical at the same time. I admit that CSS isn't always obvious how it works, but it seems like the autho…

That’s what ChatGPT told me

Re: Hardest problem in computer science: centering things

#269
post #98

Earlier quoted context omitted.

The same happens when you: - Install flooring - Install trim in your own home - Build / install cabinets You will now see: - Odd flooring patterns and uneven floors - Know what it looks like when trim isn't coped - Uneven gaps between doors

I’ve noticed these things all my life. Even as a young child I would point such things out and others would have trouble seeing it. Once I was diagnosed with autism, this tendency of mine made a lot more sense. I’m curious if other people detect interrupted or irregular patterns so readily. It’s like there’s a part of my brain just looking for anomalies and I can’t turn it off.

I'm autistic and I see patterns and issues with misaligned patterns which cause psychic pain. Also phase issues with sound because it feels physically painful.

Re: Hardest problem in computer science: centering things

#270

Earlier quoted context omitted.

I have this with spelling. Even a fractional glance at a poster/billboard/sign, without focusing my eyes on it, and certainly without reading a single word ... any misspelled word triggers a flag in my brain sort of "pinging" me with the precise location of the misspelled word.

The grocer's apostrophe (which I will argue should be called the grocers'(1) apostrophe, since there are many offending grocers) is the bane of my existence (1) My phone absolutely tried to correct that back to "grocer's"

Maybe it should be the grocer's' apostrophe, since there are many offending grocer's.
Post reply on HN