Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sections/collection-page.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
{{ image | image_tag:
loading: image_loading,
class: 'product__image',
widths: '500, 700',
sizes: '(max-width: 489px) 700px, 500px',
widths: '300, 600, 900',
sizes: '(max-width: 489px) calc(100vw - 66px), 286px',

@dabrorius dabrorius Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how browser works with sizes:

  1. Figure out the total browser width. Lets say it is a phone and width is 480px.
  2. Use sizes to determine the image size given the screen size. In this case the rule (max-width: 489px) will match and we calculate the image size to: 414px. For larger screens we will fall back to 287px.
  3. We have 3 candidate widths 300, 600, 900. Divide each width with our calculated width. We get: 0,72 1,44 and 2,17
  4. Pick the image that has ratio closest to the screen density. If it is a retina screen (2x) browser will pick the 2,17 ratio or the 900px image. If it is a regular screen it is going to pick the 600px image as this is closest to 1x ratio.

focal: focal,
alt: item.name
}}
Expand Down
4 changes: 2 additions & 2 deletions sections/search.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
loading: 'lazy',
class: 'product__image',
alt: result.name,
widths: '600, 750',
sizes: '(max-width: 490px) 750px, 600px',
widths: '300, 600, 900',
sizes: '(max-width: 489px) calc(100vw - 66px), 286px',
focal: focal
}}{% endif %}</a>
{{ result | product_availability }}
Expand Down