Picturefill

max-device-pixel-width

Allows you to define a media query based on the actual physical pixel width of the device to determine which image should be displayed. Similar to device-width but instead of using logical CSS pixels it uses the actual physical pixels.

Instructions

Resize your screen resolution or orientation to see the image swap out.

Code sample

<div data-picture data-alt="Picturefill test"> <div data-src="img/default.png"></div> <div data-src="img/1920x540.png" data-media="(max-device-pixel-width: 1920px)"></div> <div data-src="img/1440x405.png" data-media="(max-device-pixel-width: 1440px)"></div> <div data-src="img/1024x228.png" data-media="(max-device-pixel-width: 1024px)"></div> <div data-src="img/640x180.png" data-media="(max-device-pixel-width: 640px)"></div> <div data-src="img/480x135.png" data-media="(max-device-pixel-width: 480px)"></div> <div data-src="img/320x90.png" data-media="(max-device-pixel-width: 320px)"></div> <noscript><img src="img/noscript.png" alt="Picturefill test" /></noscript> </div>

Need more info? View the project
Author: Tyson Matanich