Retina images using srcset attribute
Add Retina and Responsive images using the srcset attribute in the image tag.
Basic Usage
<img src="image.jpg" srcset="image@2x.jpg 2x" alt="" />
WordPress Logo Usage
<a href="<?php bloginfo('url'); ?>"> <img src="<?php bloginfo('template_directory'); ?>/_assets/img/logo.png" srcset="<?php bloginfo('template_directory'); ?>/_assets/img/logo@2x.png 2x" alt="<?php bloginfo('name'); ?>" /> </a>
Advanced Usage
<img srcset="image-320w.jpg 320w, image-480w.jpg 480w, image-800w.jpg 800w" sizes="(max-width: 320px) 280px, (max-width: 480px) 440px, 800px" src="image-800w.jpg" alt="">