Skip to content
HN On Hacker News ↗

Death to px, long live ch!

▲ 31 points 22 comments by Brajeshwar 2h ago HN discussion ↗

Pangram verdict · v3.3

We believe that this entire text is human-written.

0 %

AI likelihood · overall

Human
100% human-written 0% AI-generated
SEGMENTS · HUMAN 1 of 1
SEGMENTS · AI 0 of 1
WORD COUNT 310
PEAK AI % 0% · §1
Analyzed
Aug 23
backend: pangram/v3.3
Segments scanned
1 windows
avg 310 words each
Distribution
100 / 0%
human / AI fraction
Verdict
Human
Pangram v3.3

Article text · 310 words · 1 segments analyzed

Human AI-generated
§1 Human · 0%

Pixels are a lie. Even if you think you're drawing something with "pixel perfect" accuracy, your monitor is lying to you. There is no grid of platonically perfect squares. In CSS, pixels are a double lie: Note that 1px doesn't necessarily equal one physical device pixel. On HD displays, it may span multiple physical pixels. Similarly, 1cm in CSS often doesn't correspond to one hundredth of SI meter. On a large TV screen, it typically is longer than that. The lengths are perceptual: 16px looks roughly the same on a phone, laptop, or TV screen at typical viewing distance. This blog is primarily text based. I want the width of the text to be readable for the average human. So, rather than setting the main width to be a percentage of the screen, I set it based on character width using the ch unit - which isn't exactly a character but good enough for my purposes: CSS--width-content: min(75ch, 100%); main { max-width: var(--width-content); } When it comes to padding and margins, the same is true. If I want a gap around an element, I want that gap to be in proportion to the text inside it. For widths, it makes sense to re-use the ch unit. I want the gap to be in proportion to the text. But for height, perhaps it doesn't make sense to express vertical distance on character width? In which case the ex unit can be used. It is the size of a typical lower-case letter. Just like my idea to eliminate CSS classes from my HTML, it's possible to go too far with this. I haven't changed every reference from px to ch, I'm just experimenting to see if it works. There's nothing wrong, immoral, or evil about using px - or any other measure unit. Using ch and ex fit with my particular proclivities.