4

I'm a bit confused about CSS pixels and whether they translate into pure resolution or physical width of devices. My question is, will content displayed on a 1080p 13 inch laptop be the same as content on a 4k 13 inch laptop? Or will everything be scaled down?

(I'm using (max-width)/(min-width) media queries and not (max-device-width)/(min-device-width) I'd be glad if you guys could clear this up for me.

2 Answers 2

2

Yes, it should render the same.

CSS uses “px” to relate “...the pixel unit to the reference pixel...”, thus a single CSS “px” could represent more than one physical pixel as different devices (ie. HD vs. 4K) have different pixel densities.

A single “px” in CSS should always be about 1/96 of an inch though. You may see variations in rendering based on browser rendering and/or monitor resolution quirks.

Sign up to request clarification or add additional context in comments.

1 Comment

An important thing to note that the 1/96 of an inch measurement is a CSS inch which isn't the same as a physical inch. This inch actually is determined by the display's pixel density. This isn't much help for the original question as the content will actually be displayed differently on these displays. See: developer.mozilla.org/en-US/docs/Web/CSS/…
1

For most cases, desktop and laptop displays will use the same pixels their resolution is set to for CSS pixels. In these cases, a 4k 13" laptop without scaling will display more content, at a smaller physical size, than a 1080p 13" laptop.

That said, there are some cases where this isn't quite true. With mobile devices the browser will use a scaled down resolution so that elements are rendered at a more natural physical size. This scaling can be determined by the devicePixelRatio - which is the ratio of physical pixels to CSS pixels.

Further reading about devicePixelRatio: https://www.quirksmode.org/blog/archives/2012/07/more_about_devi.html

Details on sizes for mobile devices: https://mydevice.io/devices/

2 Comments

Thanks for your answer. Is scaling for browsers (Chrome, for instance) determined by the Windows display settings?
With the windows display scaling, it changes how many physical pixels are used to render a logical pixel on the screen. It will affect how content is seen in the browser but the browser will not be directly aware of it. If it were set to 200%, a 1080 screen would only be seen to have 540 CSS pixels of height to work (every logical/CSS pixel would end up using 4 physical pixels, showing the content physically larger).

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.