Image SrcSet widths - is this correct, as doesn't work

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Image SrcSet widths - is this correct, as doesn't work

Post by simonmlewis »

Code: Select all

<img srcset='/images/responsive_475.jpg 475w, 
/images/responsive_768.jpg 768w, 
/images/responsive_1024.jpg 1024w,
/images/responsive.jpg 1920w,
/images/responsive.jpg 2560w'
(max-width: 475px) 475px,
            (max-width: 768px) 768px,
            (max-width: 1024px) 1024px,
            (max-width: 1920px) 1920px,
            (max-width: 2560px) 2560px'

 src='/images/homepromo-responsive.jpg' alt='tag' />
On my iPhone 7, I am getting the 768 image, not the 475 image. I know because the 475 one is much taller than the 768 image.
I've seen it done without the max-width code. But even with that, it does't work.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply