Exposing hardware pixel density and other screen metrics via window.screen


#22

There is no restriction in CSS to only whole numbers of px. You can do left:.5px just fine.

(Some browsers might have integer restrictions for some properties in practice, but they’re generally moving towards all layout-related properties being stored internally in either 1/60 or 1/64 of a CSS px. It’s important to keep them in integer math for speed and precision.)

(Border code is a mess of hacks in all browsers, because people notice and complain about fuzzy borders if they’re not device-pixel aligned, and also notice and complain about border widths rounding to different numbers of device pixels in different places. As a result, browsers tend to be conservative there.)