Live data from Hacker News

Hardest problem in computer science: centering things

tonsky.me

21–30 of 473 posts

Re: Hardest problem in computer science: centering things

#21

I'm out of the web development game, but in my day it was still quite possible to vertically center text and icons consistently. You just had to notice it was busted in the first place, and then go in and fix it. It's not a technological problem, or at least not a non-trivial one. The problem is that, if it's off by a couple pixels, the front-end engineer may not notice it, and the designer may not even look at it. O…

No, this was never possible, not in web development. You could do it in one browser on one OS, but then they could be off on another browser on another OS. It's absolutely a technological problem because pixel-perfect rendering and alignment is not part of the HTML/CSS specs, when it comes to how fonts get drawn. The only way to actually get it perfect is to do browser and OS detection and then hand-code a bunch of m…

I don't think you have to have a "pixel-perfect" rendering system to support centering things correctly?

Re: Hardest problem in computer science: centering things

#22

First time probably ever that I've had to disable Javascript because of the creepy and distracting mouse thing. It really feels like you're invading other people's privacy, and if it doesn't, having things randomly move across your field of vision makes it difficult to read.

> It really feels like you're invading other people's privacy

Incredible, massive, outstand leap from "showing anonymized cursors" to "invading people's privacy"

Re: Hardest problem in computer science: centering things

#23

First time probably ever that I've had to disable Javascript because of the creepy and distracting mouse thing. It really feels like you're invading other people's privacy, and if it doesn't, having things randomly move across your field of vision makes it difficult to read.

I had to open up devtools to be sure, but yeah, there's a websocket that constantly streams your cursor position up to the server and constantly streams everyone else's cursor positions down to you for rendering.

As someone who compulsively scrolls, selects and fidgets while reading, it actually made me quite self conscious to realize that other people would be distracted by my all-over-the-place mouse movements.

Re: Hardest problem in computer science: centering things

#24

First time probably ever that I've had to disable Javascript because of the creepy and distracting mouse thing. It really feels like you're invading other people's privacy, and if it doesn't, having things randomly move across your field of vision makes it difficult to read.

Oh, that's what that is? Holy shit that's annoying

Re: Hardest problem in computer science: centering things

#25

First time probably ever that I've had to disable Javascript because of the creepy and distracting mouse thing. It really feels like you're invading other people's privacy, and if it doesn't, having things randomly move across your field of vision makes it difficult to read.

I had to open up devtools to be sure, but yeah, there's a websocket that constantly streams your cursor position up to the server and constantly streams everyone else's cursor positions down to you for rendering. As someone who compulsively scrolls, selects and fidgets while reading, it actually made me quite self conscious to realize that other people would be distracted by my all-over-the-place mouse movements.

[deleted]

Re: Hardest problem in computer science: centering things

#26
Text-Box-Trim

I’m surprised ‘text-box-trim’ wasn’t mentioned.

It’s a CSS attribute that solves this on the web.

https://caniuse.com/css-text-box-trim

If only browsers would support it.

Until then, here’s a JS alternative.

https://seek-oss.github.io/capsize/

Re: Hardest problem in computer science: centering things

#27
post #14

> don’t ask why you need to remember four words instead of just horizontal/vertical, it’s still better than before The reason is "display: flex" can be a column or row. The "align-items" property describes alignment along the axis, so vertical for column and horizontal for row. The "justify-content" property is the other direction.

[dead]

Re: Hardest problem in computer science: centering things

#28
post #7

> That’s exactly why people love web programming so much. There’s always a challenge. LOL, these examples are exactly why I got out of web programming. Thankfully I never had to deal with any of the modern frameworks. I was getting hot flashes just scrolling through this page.

There is challenging for the wrong reasons then there is challenging for the right reasons.

You will want to make sure you work on things that are challenging for the right reasons.

Re: Hardest problem in computer science: centering things

#29

Text-Box-Trim I’m surprised ‘text-box-trim’ wasn’t mentioned. It’s a CSS attribute that solves this on the web. https://caniuse.com/css-text-box-trim If only browsers would support it. Until then, here’s a JS alternative. https://seek-oss.github.io/capsize/

Hardly worth mentioning a feature supported by...nothing
Post reply on HN