We finally learned to center a div, then browsers added sidebars
71–80 of 172 posts
Re: We finally learned to center a div, then browsers added sidebars
#72This 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.
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
#73Earlier 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.
Re: We finally learned to center a div, then browsers added sidebars
#74Re: We finally learned to center a div, then browsers added sidebars
#75I'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!
Re: We finally learned to center a div, then browsers added sidebars
#76Earlier 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.
Re: We finally learned to center a div, then browsers added sidebars
#77Am 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.
Re: We finally learned to center a div, then browsers added sidebars
#78Earlier 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 .
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
#79Earlier 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…
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
#80This 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.