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.
We finally learned to center a div, then browsers added sidebars
21–30 of 172 posts
Re: We finally learned to center a div, then browsers added sidebars
#22Re: We finally learned to center a div, then browsers added sidebars
#23This 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.
Re: We finally learned to center a div, then browsers added sidebars
#24The net result of what this site is doing seems to result in one of two effects when I open the sidebar, randomly: 1) the sidebar covers the content, while the content has blank space to the right, or 2) the content moves off the right edge of the screen, leaving a large blank space to its left. Both of these are wrong. If I have a sidebar open, the site is now narrower , stop trying to be clever. My immediate reacti…
Re: We finally learned to center a div, then browsers added sidebars
#25Screenshots would be helpful, because (you may be surprised to learn that) it is not entirely obvious which mode of behavior is supposed to be "wrong". Anyway, I wouldn't say it currently behaves nicely (like something I would like to reuse anywhere whatsoever). Tested on Firefox opening Bookmarks on the left. First off, there is this ugly flicker, as browser first renders the "wrong" version, then your JS "fixes" it…
Re: We finally learned to center a div, then browsers added sidebars
#26... why on earth is the offering a "page" ie emulating a printed page? In portrait!
I'll accept that most people are not fixated about grammar, punctuation or basic decency: that's fine.
However a "page" in portrait that looks awful on a landscape screen is unpleasant. You can easily request my viewing parameters and adjust accordingly. It's even worse when you are dispensing advice about www page layouts.
Re: We finally learned to center a div, then browsers added sidebars
#27Re: We finally learned to center a div, then browsers added sidebars
#28I use a single browser instance in a tiled window manager, occupying a fixed window directly in front of me, usually with a sidebar open. When a site intentionally centers a fixed-width container, the sidebar leaves that container visibly off the dead center of my screen. I happen to dislike that. This is a personal aesthetic preference for my particular setup, not a claim that viewport centering is generally wrong.
The intended behavior does not remove content or replace responsive layout. The sidebar still narrows the webview and the page reflows normally, the correction only repositions the container that was already meant to be centered, so its center remains in the same physical place. If content ends up covered, offscreen, or stuck in the wrong state, that’s a bug.
I don’t particularly mind the brief movement while toggling a sidebar, since the browsers I use already visibly resize and reflow pages while doing so.
I’m considering reverting the behavior on the blog and keeping it extension only. I’ve also added GIFs to the post showing the intended effect.
Re: We finally learned to center a div, then browsers added sidebars
#29The net result of what this site is doing seems to result in one of two effects when I open the sidebar, randomly: 1) the sidebar covers the content, while the content has blank space to the right, or 2) the content moves off the right edge of the screen, leaving a large blank space to its left. Both of these are wrong. If I have a sidebar open, the site is now narrower , stop trying to be clever. My immediate reacti…
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.
Re: We finally learned to center a div, then browsers added sidebars
#30This 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.