October 2017
Intermediate to advanced
522 pages
10h 9m
English
To add a set of images to the image tag, comma separate each image. We're providing the regular-sized image first. Then we'll add images/jaws@2x.jpg:
<img src="images/jaws.jpg" srcset="images/jaws.jpg, images/jaws@2x.jpg" alt="Jaws movie">
The browser actually needs something else to let it know that it's a larger image, something called the pixel density descriptor, or just the X descriptor. Let's add that, as shown in the following screenshot:
<img src="images/jaws.jpg" srcset="images/jaws.jpg 1x, images/jaws@2x.jpg 2x" alt="Jaws movie">
Following each image string, I'm going to provide a space and then the X descriptor. So the first image string will be 1x, and the second one will be 2x. The X descriptor ...
Read now
Unlock full access