Hacker News .hnnew | past | comments | ask | show | jobs | submitlogin

Some people see `px` and assume it's physical pixels and because they know some devices have different pixel densities, they go complaining about how coding in terms of pixels instead of `em` doesn't account for density, unaware that `px` refers logical pixels[0]

[0] https://blogs.perficient.com/2014/12/24/css-pixel-ratio-or-h...



First, that article is about smartphones. Second, even on smartphones, logical or physical, pixels are not related to text, they are related to the screen resolution.


Not sure what argument you're trying to make; can you clarify? This article is also partially about smartphones (dark mode, responsiveness, etc). Back when `em` was not a thing yet, text was measured in `px`, where 16px was considered to be the "default" size for readability purposes (and `em` sizes are a function of a base value in `px`).

Saying that pixels are unrelated to text isn't really accurate, since text obviously occupies space and pixels are a unit of space, and back in the day, expressing layout relationships in terms of pixels was fairly standard.


If the font size is different, em width adapts to that, px width doesn't. Text occupies space in pixels, but not vice versa.


Yes I'm aware of that. But regardless of whether you mean this in the sense of adapting to user stylesheets or the idea that disparate elements' font sizes should relate to each other, they both strike me as maintainability trade-offs that can reasonably go either way. An elitist tone seems a bit unnecessary in that context.


The font size can change due to zoom, which is a must, because 16px is too small text and unreadable.


cmd+"+" has always worked regardless of what unit is used, though?


Elements measured in pixels (like images) don't change size when text changes size.




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

Search: