Questions tagged [srcset]

The srcset attributes on the img element can be used, using the x descriptor, to provide multiple images that only vary in their size

390 questions
7
votes
1 answer

Browser is loading two images - one for srcset, one for src (Chrome 41 et al)

I'm using the srcset attribute on a web page I'm developing.
Miglosh
  • 157
  • 2
  • 7
7
votes
2 answers

Do latest Chrome / Opera get srcset wrong?

I'm working on a page that has the following markup:
Tyssen
  • 1,569
  • 16
  • 35
6
votes
2 answers

picture srcset with webp - how to implement sizes?

I'm trying to have a picture tag with WebP support. ( load image-full if the screensize is over 1024px, image-1024 for max-width 1024px, image-768 for max-width 768 px and image-500 for max-width 500px ) I've got this code, and w3 validator is…
user1692094
  • 302
  • 2
  • 5
  • 12
6
votes
1 answer

Why is my img element always loading the biggest image from srcset

So, I'm trying to make a responsive image component that will load an appropriate size of image depending on the screen resolution/pixel density. As I understand it, the srcset attribute was designed for exactly this, but I can't get it to do what I…
Supperhero
  • 911
  • 1
  • 7
  • 24
6
votes
1 answer

Sizes attribute for Bootstrap responsive breakpoints

I'm working on optimization on my page and it was all going smoothly since I came up with an idea to implement srcset and sizes attributes to my . I create php function that constructs img object and fills srcset attribute with new scaled…
6
votes
1 answer

Wordpress responsive images - Selecting wrong image on retina screens

I've been working hard on trying to get responsive images working on this website I'm building and just when I thought it's going well, I look at it on the iPad retina screen and it's selecting the wrong image. Not only is it the wrong size but it's…
Shaun
  • 757
  • 1
  • 8
  • 36
6
votes
2 answers

Safari not requesting srcset images on resize

I want to provide responsive images, for that I use srcset attribute.
Mikel
  • 5,902
  • 5
  • 34
  • 49
6
votes
2 answers

srcset, do I still need to write "1x,2x,3x" if I've specified the width of each image?

should I write this srcset="small.jpg 1x 500w, medium.jpg 2x 1000w, large.jpg 3x 1500w" or this srcset="small.jpg 500w, medium.jpg 1000w, large.jpg 1500w" are the two expression the same?
Rick
  • 7,007
  • 2
  • 49
  • 79
6
votes
2 answers

How do responsive images work with `em` supplied as a length in `sizes`?

How can browsers understand the em unit when used in a responsive image? A giraffe This validates, and I'm not seeing…
Tigt
  • 1,330
  • 2
  • 19
  • 40
5
votes
0 answers

Google Lighthouse: Using wrong image of SRCSET

I am using an image slider (owl carousel 2) and have implemented images as follows:
ralex
  • 85
  • 6
5
votes
2 answers

How to load the image form the srcset attribute of the in Webpack?

I started using the tag in my Webpack app and noticed that the current setup is not working with the images referenced in the srcset:
LBRTYCAT
  • 53
  • 1
  • 4
5
votes
2 answers

How to use srcset 2x with React and Webpack?

From this answer Dynamically Add Images React Webpack I know, how to use usual image src with React + Webpack. How can I get the same result with srcset 2x having a space inside? It looks like I can't import from a string like this: import picture…
user4851524
5
votes
1 answer

HTML srcset - when to use the x descriptor?

I'm reading up on responsive images in HTML5 and have a question. When would you use the x-descriptor? If for example you have different resolution versions of the same image why would you ever not use the w-descriptor? As I understand it if you…
5
votes
3 answers

how to determine highest resolution image from srcset

Say i have an image as A woman reading Now this can also be in a format like
Tushar Shukla
  • 5,666
  • 2
  • 27
  • 41
4
votes
2 answers

responsive images with srcset, sizes, media-queries - Prevent loading huge images for higher pixel density

I used picture element for responsive images in different sizes per viewport a long time. it worked fine, but now I am forced to switch over to responsive with srcset and sizes and I try to rewrite my picture element to the IMG-style. After…
Radon8472
  • 4,285
  • 1
  • 33
  • 41
1 2
3
25 26