If your device has a width of 1080 pixels, that is considered to be the device-width
, which represents the physical pixels on the screen. When the device-pixel-ratio
of the device is, for instance, 3
, it means that each "css pixel" equals 3x3 device pixels. In a media query, setting max-width: 500px
refers to the "css pixels", so with a device-pixel-ratio of 3, this would translate to 1500 device pixels. As a result, your phone's screen size would be 760x360 (css) pixels.
The high device-pixel-ratio, such as those found in retina displays, offers the advantage of displaying vector graphics, fonts, and high-resolution images with enhanced detail and better resolution. Despite this, the pixel unit in CSS rules continues to refer to the "css pixels," explaining why your background appears blue or the media query is implemented.
You also have the option to utilize min-device-width
/ max-device-width
in media queries. Nevertheless, in most cases, it is recommended to use max-width
/ min-width
and consider working with "css pixels."
P.S.: The "computer mode" you mentioned likely disables or alters the settings within the viewport
meta tag.