Skip to content

Responsive Images: Include Note on Device Pixel Ratios #28761

@columk1

Description

@columk1

Checks

Describe your suggestion

Issue

The assigned resources assume some knowledge of device pixel ratios. There are a couple of mentions of pixel density and device pixels as well as use of a multiplier syntax in the sizes attribute but these terms aren't really explained. This is an important factor to consider when placing images and deserves to be covered to provide more context for these resources.

Recommendation

Include a lesson note towards the end of the lesson with a concrete example:

CSS Pixels Vs Physical Pixels: Pixels on a screen don’t always map one-to-one with CSS pixels due to varying Device Pixel Ratios (DPR).
DPR determines how many physical pixels are used to display a single CSS pixel in the viewport. Higher DPR values mean sharper displays but they require higher resolution images to avoid blurriness.

Let's take the iPhone X as an example. It has a DPR of 3, meaning each CSS pixel is rendered using 3×3 = 9 physical pixels. The viewport size on this device is 375px x 812px (logical CSS pixels) but the actual screen resolution is 1125px x 2436px (physical pixels). An image that fills the width of the device’s viewport (375 CSS pixels wide) would need to be 375 × 3 = 1125 pixels wide in physical resolution to appear sharp. An image 375 pixels wide will fill the viewport but it will be blurry due to repeated pixels.

Another option is to include another resource. https://web.dev/learn/images/descriptive
This one is really good but there is already a lot of reading in the current resources and there is some overlap, that's why I suggest adding a note to the lesson.

Path

Ruby / Rails, Node / JS

Lesson Url

https://www.theodinproject.com/lessons/node-path-advanced-html-and-css-responsive-images

(Optional) Discord Name

columk

(Optional) Additional Comments

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions