Live data from Hacker News

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

seg6.space

121–130 of 172 posts

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

#121
post #119

The sidebar reduces the size of the viewport, and the viewport is what you're centring within. This is obvious and sensible behaviour from Firefox. Please don't centre based on screen res or whatever. Basing your centre position on anything other than the viewport is user-hostile behaviour.

Perhaps bad design, but user-hostile is a bit of a stretch.

Its an entire misunderstanding of how the layout system works.

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

#122
> This is a fairly specific itch. I use one browser window tiled directly in front of me, usually with its sidebar open. When a site deliberately centers a narrow layout, I want it at the dead center of that window, not the space left over beside the sidebar.

I still don't understand the need for this. I mean, it's hn, so "I wanted to" is a perfectly acceptable reason, but when you resize and move the browser window, you don't expect the content to remain where it was. The browser window is not a literal window that shows you what's behind your screen. If the sidebar should behave like an overlay, then that's something that the browser should manage, not each website. From the blogpost I can see that this preference is highly subjective, so it being a browser-wide setting makes much more sense.

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

#124
post #24

The 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.

That is only really possible if the window is full screen. By that logic it feels like if the user changes the window size you would want the div to stay in the center even then.

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

#125
post #98

Earlier quoted context omitted.

Why? The window and its position shouldn't matter to the app. My tiling window manager doesn't care what your snowflake app thinks it wants, and I don't either.

Then continue to enjoy your broken popup menus and combo box drop downs, for starters.

Are these broken popup menus and combo box dropdowns with us in the room right now?

Yes, some things in some complex applications can break, but there are solutions and, practically, these particular things you listed simply aren't among those that break.

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

#126
post #95

Earlier quoted context omitted.

I use Firefox with a vertical tabs extension open all the time. Occasionally (rarely, mind) I run into sites that don't bring their full content into view unless I hide the tabs list. Guess they think like the OP.

I used Tree Style Tabs until recently, and never experienced this. Also now with the native vertical tabs I've never seen this.

It almost never happens. And when it does it may be some other broken calculation. But I did run into sites that I can only guess did their layout based on the whole window and had stuff go under the tree style tab.

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

#127
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.

The point of centering an element horizontally is to give equal space either side. Because you consider that to look best visually with your design. It has nothing to do with where it is in front of you, or anything other than placement in the space you have. Given a width for your content where should it sit. If you don't like the effect with a browser sidebar, don't limit the width with a browser sidebar.

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

#128
post #24

The 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.

[dead]

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

#129
For some reason, this made me think of privacy & security issues: user fingerprinting, user-type detector (devtools open = dev/engineer) etc.

Detecting the difference between window.innerWidth (viewport) and window.outterWidth (window with bar etc) in JS, can be powerful to the browser user via an Extension. However, not so if the site/page uses (e.g a JS Lib).

Personally, i like the viewport vs window separation that the browser provides. I don't want an Element to not budge or care about my sidebar/window dressings, thank you very much.

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

#130
post #97

Earlier quoted context omitted.

You'd be surprised

That's somehow controversial? There are kiosks used for public browsing, where the user has access to full browser app window and can change elements. There are also ways to get around kiosk mode restrictions, or at least there were for Windows in kiosk mode back in the day. We used it to get browsing access or to just mess with the kiosk. The fun!

> There are also ways to get around kiosk mode restrictions, or at least there were for Windows in kiosk mode back in the day. We used it to get browsing access or to just mess with the kiosk. The fun!

And that's probably by far the most value those kiosks ever provided to society - the chance of overriding whatever malicious, socially harmful marketing bullshit purpose they overtly served, and do something fun or useful with them instead.

Alas, opportunities like this are disappearing, as security maximalists are running the show in our industry these days.

Post reply on HN