[wp-trac] [WordPress Trac] #44655: Introduce alternative srcset option for custom logo
WordPress Trac
noreply at wordpress.org
Mon Jul 30 12:00:04 UTC 2018
#44655: Introduce alternative srcset option for custom logo
-------------------------+------------------------------
Reporter: mrmadhat | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by mrmadhat):
@joemcgill I've taken some time to look at srcset and sizes to try and get
a better understanding of what is happening.
From my understand, `srcset` is providing the browser with multiple
options of images to choose from and 000w is telling the browser the width
so it doesn't have to fetch each image to find out their dimensions.
`sizes` is saying what size the image will be based on a given dimension.
CSS then dictates the actual width/height. From that information the
browser will choose the most appropriate image.
I can see that this works when `sizes` is given the correct information
but the output doesn't seem to be correct. If I specify a height (186) and
width (38) I would expect the following given a user uploading at the
correct dimensions:
1x - 186 x 38\\
2x - 372 x 76\\
3x - 558 x 114\\
However with the current `sizes` value `sizes="(max-width: 558px) 100vw,
558px"` the 3x image will always be chosen (regardless of the css width
and height values). I have created a sample showing this
https://codepen.io/relativemc/pen/rrpWxm and here is a screenshot showing
the result on a 1x screen:
[[Image(https://i.imgur.com/EiPpNNP.png)]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44655#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list