Live data from Hacker News

We finally learned to center a div, then browsers added sidebars

seg6.space

71–80 of 172 posts

Re: We finally learned to center a div, then browsers added sidebars

#72
post #15
post #4

This might be some kind of a weird requirement for a piece of art, but I would literally never expect a website to center a div according to the browser window instead of the viewport. It just looks wrong and feels wrong.

The point of centering an element horizontally is to make sure that the content you’re viewing is directly in front of you. Browsers with a sidebar shift the content to the right, assuming the sidebar is on the left, which I’ve come to dislike! Others have expressed the same preference, hence this little snippet on my website.

Stop worrying about what's happening outside the viewport. Your website has no right to care or even know what's happening outside the viewport.

Anyone got a Tampermonkey script or tiny extension to re-override this to make such sites actually center in the viewport, like I prefer?

Re: We finally learned to center a div, then browsers added sidebars

#73

Earlier quoted context omitted.

Same. Thank heavens the website doesn't know the position of the browser's window in respect to the screen it's on.

Wait until they realize that on mobile they can use accelerometer data to keep the element in the same position in space across translations of the device.

Stop giving them ideas! :(

Re: We finally learned to center a div, then browsers added sidebars

#74
post #41

Earlier quoted context omitted.

So the content falls down at 10 m/s^2 unless you're falling alongside it.

But the problem is, you can never quite catch up to it without a rocket.

No, you can also take your clothes off and throw them upward with sufficient force.

Re: We finally learned to center a div, then browsers added sidebars

#75
post #67

I'm confused about why this website is using less than half of my window for content. I understand wanting some margins, but a third of my window on each side seems pretty egregious. At least it's centered though!

wrapping text at 55-75 characters per line is often recommended in digital typography by UX. research implies that an optimum length exists to maximize reading speed, and although it depends on many factors 55-75 is often parroted as a universal rule.

Re: We finally learned to center a div, then browsers added sidebars

#76
post #60

Earlier quoted context omitted.

There's several web APIs for browser window positioning, like screenX/Y[0] (which is what OP uses), which allows for those classic pop-up based browser games from over a decade ago, like Browser Ball.[1] [0]: demo: https://mdn.github.io/dom-examples/screenleft-screentop/ [1]: https://romanbaiocco.github.io/browser-ball-reloaded/

For this to work, the browser itself would have to know where its window is placed on the screen. Not all platforms provide such information.

While providing this information to websites without user permission is probably a longstanding mistake of web browsers, windowing systems withholding proper on-screen positioning from native applications is a bug in that system - a bad one.

Re: We finally learned to center a div, then browsers added sidebars

#77

Am I the only person that loathes sidebars in browsers? Maybe it's because I've been using a browser since 1996, but my brain is deeply set in the idea that the space below the chrome 110% belongs to user space. I've tried a few browsers with vertical tabs, and my brain keeps seeing them as part of the page itself. It's a very distracting and uncomfortable experience.

Do you always have browsers maximized? If you're used to other windows next to the browser then I'd be surprised if you still find sidebars distracting.

Re: We finally learned to center a div, then browsers added sidebars

#78
post #24

Earlier quoted context omitted.

Agreed, both outcomes are bugs and neither is intended. The idea is simply that, content the site author intended to be horizontally centered stays literally centered on my screen when browser UI changes the viewport.

That results in the first outcome: the content is centered on the screen, which puts it under the sidebar, while there's perfectly good space being ignored off to the right of it. It's a cute trick, please don't use it, this is one of many reasons why. If I have a sidebar open, it's because that space is not yours to care about .

> If I have a sidebar open, it's because that space is not yours to care about.

Drawing UI is hard. Firefox likes to draw the websites underneat the scrollbar. Google likes to draw system nabigation buttons over the window with all kind of funny interractions. That's what happenes when you train people "on the job".

Re: We finally learned to center a div, then browsers added sidebars

#79
post #52
post #24

Earlier quoted context omitted.

Agreed, both outcomes are bugs and neither is intended. The idea is simply that, content the site author intended to be horizontally centered stays literally centered on my screen when browser UI changes the viewport.

Think about users who don’t maximize the window, for whom centering to the screen, not viewport, would just be broken. It’s right to center to the viewport, and right that you’re able to turn that into centering to the screen by maximizing. The issue, I think, is that you don’t like that the sidebar changes the viewport, and really want a popup menu. I think your browser might duplicate sidebar functionality in confi…

> Think about users who don’t maximize the window, for whom centering to the screen, not viewport, would just be broken.

This in blasphemy. Never, ever, think about the user. Users are idiots anyway. The apps shall be used for their intended purposes. All windows shall be maximized ( because we say so). /s

Re: We finally learned to center a div, then browsers added sidebars

#80
post #4

This might be some kind of a weird requirement for a piece of art, but I would literally never expect a website to center a div according to the browser window instead of the viewport. It just looks wrong and feels wrong.

Televisions used to have "sidebars", like a speaker on one side only, with some knobs co-located there also. Yet a test pattern would center in the picture tube, not the TV box.

Thank god there was no Google then. They would have put the knobs on the screen.
Post reply on HN