6

Coming from a design time pre-digital and musing over the 'pixel' would a physical measurement such as a cm work in web design at some point? Do all devices have a designated ppi (pixel per inch) value?

I know you have ems, rems, %, etc but is a cm such a bad idea? Devices do exist in the physical world after all.

1
  • Should it thus make the Zoom In/Out function in browsers stop working?
    – Jongware
    Commented May 6, 2016 at 9:44

3 Answers 3

3

The devices are not what determines the pixel per inch value. This is determined instead by the browser used. This allows it to be more standardized, but not perfect by any means.

All browsers convert physical units like cm and in to pixel values out of necessity for display. However, their true pixel values depends on whether or not it's a high resolution device or print or low resolution device. High resolution and prints are supposed to be the same as the physical length, but it is not perfect. As for what pixel values physical lengths are converted to, you can view a full chart of conversions.

In practice, using physical units is acceptable as a scalar for pixels. But you have to keep in mind that 1in will not really be 1 inch. However, you must test the output on all the relevant platforms that interest you (possibly including print) to make sure it behaves the way you desire.

Also keep in mind that really old browsers (think IE6) cannot scale physical units when zoomed. Another potential issue is that really old monitors may not be able to send their size to the OS, which would make it impossible to use physical units as media query points on those devices.

For a more full history of the physical units conundrum, you can read this post.

4
  • Thanks for the great reply Zach - I did not know it was the browser that determined the ppi. I read that post earlier today - sure is interesting. Thanks
    – Kleptonite
    Commented Feb 12, 2016 at 15:30
  • IE6 and below??
    – Cai
    Commented Feb 12, 2016 at 19:08
  • 1
    @CAI I have no idea about support on earlier IEs :) Commented Feb 12, 2016 at 19:23
  • 3
    Considering IE6 accounts for < 0.1% of usage (according to Microsoft it's 0% in the US!) I think we can finally forget about support for that.. and I have no idea when the last time anyone supported anything older than IE6!
    – Cai
    Commented Feb 12, 2016 at 19:55
1

Pixels also exist in the physical world.

The centimeter and inch measurements in CSS are for print output devices, not for screen output devices. They are for making a print stylesheet.

You don’t gain anything by talking to the screen in centimeters because fundamentally, you are making a screen rendering at the browser’s current pixel size and pixel ratio. Not knowing that pixel size and pixel ratio because you are working in centimeters doesn’t help you.

So the immutable paper size from paper design is equivalent to the immutable pixel size from screen design.

0

You may not want to use physical units on the screen, the main reason I can think is, the vast amount of screen sizes and pixel density combinations currently available. It will be a nightmare to fix position issues in each combination available, in fact the main reason for units like rem, ems, etc. to exist is because of this paradigma.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.