I'm currently grappling with CSS media queries for a mobile-centric webpage. My main objective is to maintain consistent font sizes on the page, regardless of device physical size and resolution specifications that may vary. However, I am finding that the data reported by the media queries does not always align with the actual device characteristics.
For testing purposes, I am using an HTC One M7
with a display resolution of 1080x1920
pixels and a pixel density of 467dpi
, according to the manufacturer's specifications.
The exact values returned by the media queries are as follows:
width (as indicated by min-width/max-width): 1080px
resolution (as indicated by min-resolution/max-resolution): 288dpi or 3.0dppx
Firstly, shouldn't the width in pixels be represented in logical pixels rather than physical ones? For example, both the iPhone3GS
and iPhone4
report a width
of 320px
, even though the latter actually has 640 physical pixels. This raises the question of how to interpret the term "pixel
" when comparing it against specific queries.
Secondly, the reported 288dpi
does not correspond to the actual device pixel density of 467dpi
. How exactly is this 3dppx
metric calculated?