HeadlinesBriefing favicon HeadlinesBriefing.com

Pixels Are A Lie Long Live Ch

Hacker News •
×

Pixels are a lie. Even with "pixel perfect" accuracy, monitors do not display platonically perfect squares. In CSS, 1px does not equal one physical device pixel; on HD displays, it may span multiple pixels.

Similarly, 1cm in CSS often does not correspond to one hundredth of an SI meter, typically being longer on large TV screens. These lengths are perceptual: 16px looks roughly the same on a phone, laptop, or TV at typical viewing distance. This text-based blog sets width based on character width using the "ch" unit rather than screen percentages, ensuring readability.

For gaps and margins, the author reuses the ch unit for width proportion and the "ex" unit for height, relating to typical lower-case letter size. While not converting every reference from px to ch, the author experiments to see if the approach works, noting there is nothing wrong with using px. The philosophy fits the author's particular proclivities.