CSS Unit Might Be a Combination
Posted3 months agoActive3 months ago
oddbird.netTechstory
calmmixed
Debate
60/100
CSSWeb DevelopmentUi/ux
Key topics
CSS
Web Development
Ui/ux
The article discusses potential improvements to CSS units, sparking a discussion among developers about the best practices for unit selection and the limitations of current CSS capabilities.
Snapshot generated from the HN discussion
Discussion Activity
Very active discussionFirst comment
2d
Peak period
25
Day 3
Avg / period
11.3
Comment distribution34 data points
Loading chart...
Based on 34 loaded comments
Key moments
- 01Story posted
Sep 29, 2025 at 9:13 AM EDT
3 months ago
Step 01 - 02First comment
Oct 1, 2025 at 8:04 PM EDT
2d after posting
Step 02 - 03Peak activity
25 comments in Day 3
Hottest window of the conversation
Step 03 - 04Latest activity
Oct 14, 2025 at 5:35 AM EDT
3 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45413330Type: storyLast synced: 11/20/2025, 12:29:33 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
Anyways, CSS is fine. The problem space is complicated.
Nested tables and inline styling yeah. It works better. It's always worked better, unless you're handwriting your HTML, and virtually no-one does that anymore.
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
https://css-tricks.com/snippets/css/complete-guide-grid/
As an aside, hand-rolling HTML templates is still pretty common (such as for SSG themes), which is substantially similar to hand-rolling HTML. You just get `if` and `for` and a couple other primitives.
I still remember the star selector pattern to prevent IE6 from reading malformed css. So me old.
But having grown up in my early career during the transition from embedding styles into html to sites like css zen garden, I am extremely critical of modern "frameworks".
I still see so much bloat in poor performing pages and often when I dig deeper it's tailwind in addition to other inefficiencies adding repeated cruft that doesn't help with site rendering.
A proper 20 year old understanding of css class style inheritance isn't hard, and it negates 80-90% of the complexity of maintaining complex web apps (react components mainly).
CSS grids are cute and useful, but for a hell of a lot of web interfaces a simple float and clear:left still works wonders.
A new styling language, with better syntax, written taking into account real-world scenarios, widely deployed across all browsers (or at least cross-compiling into CSS)?
I wouldn't hold my breath.
It has never translated well to custom font settings from a user browser, but it turns out those are exceptionally rare vs people who just ctl/cmd +/- on the keyboard or pinch and zoom on the phone.
[1] https://developer.mozilla.org/en-US/docs/Web/API/Window/devi...
[2] https://stackoverflow.com/a/35244519
This is common among visual technologies.
There are logical pixels, an abstract description of size.
And there are physical pixels, that are the actual dots of color.
---
This is not unlike a printed page of text.
The font size is measured in points.
The physical output is dots and determined by DPI.
I targeted Firefox and ended up with some bonkers magic constant where a pixel was actually like 1.05 pixels or something.
If I don't render enough it'll be blurry. If I render too many it's wasteful. If I am slightly off then the filtering will make it look weird
It's not a phone with a Bayer matrix, it's not VR, I don't know why they have to be weird about it
The browser can do pixel perfect rendering, it has to for sharp text. But in WebGL there is no reliable way to get the coordinates to do so as well. Browser specific ways to do so exist, but using standard APIs doesn't work browser zooms like 130% or DPI scales like 1.25 in combination with certain resolutions.
But yes you can have "bonkers" devicePixelRatio. Namely, when the browser is zoomed.
Logical pixels measure UI "size." And Physical pixels (logical pixels * devicePixelRatio) is the number of dots.
Your game layout should target logical pixels. And rasterization, textures, etc should target physical pixels.
If weird devicePixelRatio causes problems with a lot of pixel-exact UI, you may choose to use your own logical pixels that has a rounded devicePixelRatio.
---
I have a MacBook with a retina display. Versus a non-retina display, I would not expect that everything is 2x smaller, but rather 2x more detailed (or, if not that, the same level of detail but same size). That important distinction is reason for two different constants.
Exactly that is unfortunately not possible, you may or may not get off by one resolution.
> I would not expect that everything is 2x smaller
Of course.
> but rather 2x more detailed
That's specifically the thing you cannot guarantee, as sometimes due to lack of standarization, it maybe 2.01x size, leading to those UI elements being the right size, but slightly blurry due to pixel grid mismatches.
There are two approaches these days though: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/W...
I'm aware of those, it's just sad nothing is nailed as a standard. Those are two workarounds unfortunately. A browser API not supported on Apple Safari and pixel-presnap with JS doing the CSS px calculation backwards + snapping and even that code has an extra branch to fix a macOS+Chrome bug. The whole situation smells of duct tape.
On some em-based websites I’ve seen them break at high zoom levels defeating the purpose.