I’ve found that ch and ex units are heavily influenced by latin characters. They just give weird results with non-latin characters leading to magic numbers. But the concept is really solid: use them if you want the spacing relative to text.
Nobody uses ch, let's be honest.
Death to px, long live ch
21–30 of 86 posts
Re: Death to px, long live ch
#22Re: Death to px, long live ch
#23Earlier quoted context omitted.
px is still a useful unit. the user's operating system applying a scaling fator doesn't make it not useful. if the user's operating system is configured to draw pixels at a 1:1 ratio, your pixels will be drawn at a 1:1 ratio. if the user's operating system is configured to draw pixels at a 2:1 or 3:1 ratio, you as a web developer don't get to override that, but you're still addressing pixels directly. if you want to…
The spec fafs around a bit talking about how the px is a "visual angle unit" But I am unable to form an interpretation where the "reference pixel" is anything other than 1/96 inch. https://drafts.csswg.org/css-values/#absolute-lengths I guess theoretically a tv could say "this tv will be viewed at 12 feet away so our reference pixel is 1/16 inch" and still be in spec. Which sounds like it has messy implications, Does…
pixels are pixels, and no browser implements them as a fractional-inch measurement. in every actual implementation i'm aware of, they're a hardware based unit.
Re: Death to px, long live ch
#24I will not take CSS advice from a website that looks like such utter crap on mobile
Or, have your perhaps selected one of the different themes at the top of the site?
Re: Death to px, long live ch
#25Earlier quoted context omitted.
The spec fafs around a bit talking about how the px is a "visual angle unit" But I am unable to form an interpretation where the "reference pixel" is anything other than 1/96 inch. https://drafts.csswg.org/css-values/#absolute-lengths I guess theoretically a tv could say "this tv will be viewed at 12 feet away so our reference pixel is 1/16 inch" and still be in spec. Which sounds like it has messy implications, Does…
what the spec says doesn't really matter though, the spec is just nonsense people wrote down to try to back-explain decisions that the browsers had already made. pixels are pixels, and no browser implements them as a fractional-inch measurement. in every actual implementation i'm aware of, they're a hardware based unit.
Screens very rarely contain a matrix of individual squares.
For example - https://global.samsungdisplay.com/29043/
Re: Death to px, long live ch
#26What I want to know is who decided to break px, the last thing we need is yet another screwball physical measurement, css was already full of them. But what "tut tut, everybody is using px and these new hi-dpi displays are rendering things really tiny, we can't have that" and now px as a useful unit is ruined. Is there a way to use real pixels? My, admittedly quick, search says no. at least nothing jumps out at me fr…
You could set the CSS zoom property to 1/window.devicePixelRatio with JavaScript but I think you can't do it with CSS only. If you do that then px is physical px. This doesn't include browser zoom though or mobile pinch to zoom. You could also get those with JavaScript but then people would be really confused by the behavior of your website. You definitely can't get pure integers though it's always a float even if yo…
Re: Death to px, long live ch
#27Re: Death to px, long live ch
#28Layout shift when the font loads
Not necessarily. See https://screenspan.net/fallback
Re: Death to px, long live ch
#29Earlier quoted context omitted.
px is still a useful unit. the user's operating system applying a scaling fator doesn't make it not useful. if the user's operating system is configured to draw pixels at a 1:1 ratio, your pixels will be drawn at a 1:1 ratio. if the user's operating system is configured to draw pixels at a 2:1 or 3:1 ratio, you as a web developer don't get to override that, but you're still addressing pixels directly. if you want to…
The spec fafs around a bit talking about how the px is a "visual angle unit" But I am unable to form an interpretation where the "reference pixel" is anything other than 1/96 inch. https://drafts.csswg.org/css-values/#absolute-lengths I guess theoretically a tv could say "this tv will be viewed at 12 feet away so our reference pixel is 1/16 inch" and still be in spec. Which sounds like it has messy implications, Does…
Screenshot: https://www.softacom.com/wp-content/uploads/2022/03/11111-10...
I guess you could use that setting on an old version of windows to set a screen to 16dpi, and now a CSS reference pixel is 1/3rd of a real pixel? But more realistically, what the spec is getting at is that a mobile device should set its dpi setting close to the real device setting, and a reference pixel is now something that looks about as big as a pixel on a 96dpi screen. That nobody actually sets their screen dpi on desktops is probably of secondary importance to them