Srcset code for responsive images in Squiz


(Stef) #1

What is the correct way of rewriting srcset code in Squiz to display images in different screen sizes?
Can I replace the image name with asset number?

lgbtiq flags

I tried this below to place the image location but doesn’t seem to work…

<img src="./?a=1254851" alt="lgbtiq flags" srcset="./?a=1254853 600w, ./?a=1254855 800w, ./?a=1254858 1200w, bannerLGBTIQ.jpg 1600w" />

Thanks.


(Michael Wilson) #2

Hi Stef,

Try the HTML 5 way: https://www.w3schools.com/tags/att_source_srcset.asp

Or you can make a single image responsive: https://www.w3schools.com/howto/howto_css_image_responsive.asp

Both will work in Matrix with asset IDs.

Michael