I’m trying to achieve a more solid, foundational understanding of CSS than the average developers around me. Googling snippets of CSS tricks and piling hacks upon disjointed hacks does not seem sustainable. There’s a number of things that I’m trying to learn and figure out. One thing seems obvious to me; unless you know your exact output device, you should never use pixels to locate content on the screen, because “what a pixel is” varies from device to device, and even if you didn’t, you’d have to think about different aspect ratios of devices and such. So it seems to me that in the very general case of writing CSS for the web, “don’t use pixel units in your CSS” seems like sound advice. What do you think about this? The thing is, even though this seems like an obvious problem me, I haven’t yet worked with a fully fledged website where pixels were completely avoided. I suspect that using viewport units ubiquitously is closer to the ideal I’m looking for, but I don’t know if that presents other problems (what doesn’t? 🙂 )
This idea is one way I’m trying to reason about CSS; there are just so many ways you can do things, so I’m looking for some sturdy, easily understandable guidelines. “Use viewport units, never pixel units” would be easy to remember and reason about.