The srcset attribute

Github Page

A simple test to determine if devices will display different images based on their device-pixel-ratio - using the srcset attribute.

Example

Test image

Code

Markup
<img
  srcset="assets/img/image-1x.jpg 1x,
          assets/img/image-15x.jpg 1.5x,
          assets/img/image-2x.jpg 2x,
          assets/img/image-3x.jpg 3x"
  src="assets/img/image-1x.jpg"
  alt="Test image">

Github Page