4

I hate when I have a development question and the only answers out there seem to be from 5 years ago. And when I apply those solutions, they don't work because old. All that says to me is how stupid I am for even having the question because everyone knows the secret and they're no longer talking about it.

Comments
  • 1
    But the question is about the img srcset attribute in HTML5. Seems like there’s gotta be more current helps for my specific issue (i.e. it’s not selecting a mobile image for mobile viewports) than all the way back to 2015.

    Just gotta keep digging.
  • 1
    Sure. Thank you. I'm simply trying to get the <img srcset to do anything at all. It's like the browser is completely ignoring everything and just displaying the image as enormously as possible regardless of viewport size. Here's my codepen if that helps anyone who could look at it. https://codepen.io/anon/pen/XLzoaZ
  • 0
    I’m backend as well, so I don’t know what I’m talking about.

    But when I look at examples such as https://html.com/attributes/... their form is different than yours. They descend in size, yours goes 447, 537, 217. Also other reading says while the size tag is nice, it isn’t required. So if you simplify to srcset with 447 and 217 with src 537 and remove the size attribute, what happens?

    If that doesn’t work just do two of the three and see if that works, the. Add the third back.
  • 1
    Strange, I think it's working if I replace w with px for sizes attribute. Can you confirm?
  • 1
    Thanks everyone. I was finally able to work it out through a StackOverflow post. I was using w instead of px in the sizes attribute and just totally missed that fact. The whole site I'm working on is the wrong approach, so this is just a hotfix until I can do a better design.
Add Comment