Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The viewport width is the browser width, not the screen width. What are you saying is wrong with using the viewport width?


Uh, i wrote "viewport width is not the same as the monitor width", this is the same as what you wrote.

As for why it is wrong, it is because you can't rely on it to make a Mobile vs Desktop distinction - i already provided an example why.


"Mobile vs desktop" is not a distinction websites should be making. Sites should make the best use they can of the available horizontal space.

It's still not clear to me where you think this approach gives bad results?


The problem is that the horizontal space only tells you how many pixels are available, not how big whatever you use those pixels for ends up on the screen.

The precise vs coarse isn't helpful either for something like this because this isn't just about clicking vs tapping, it is about how the end result looks - and there are PCs with both very small monitors and very big monitors (and relatively large monitors with low DPI or small monitors with very high DPI). CSS pixels only help for setting sizes/positions, but not layout.

AFAIK the best that can be done nowadays is resolution media queries but that isn't available everywhere (at least according to caniuse).

Of course in practice i expect none of the above to be used and have my browser simply zoom out whenever i reach many sites just because i do not want to maximize my browser :-/


CSS pixels are good for layout, not just sizes and positions, because a pixel (in a browser) now represents an apparent size. That is, if the user has a large device far from their face, or a small device close to their face, a pixel represents a similar portion of their vision. If they want things larger, they can adjust the scaling so a pixel represents a larger apparent size, or the reverse.


This is never true in practice though and what you describe is just about sizes and position, you can't change the layout with CSS pixels - you need resolution media queries for that.


Ergonomics of using touch screen vs. mouse.

Usage while walking/moving vs. sitting/standing at a desk.


For touch screen vs mouse, use "pointer:coarse": https://developer.mozilla.org/en-US/docs/Web/CSS/@media/poin...

Most "mobile" usage is actually stationary, typically seated. If you really need to change layout based on motion you can use the accelerometer, but I can't see why you would?




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: