My thought with media queries is that your goal should be to create an agnostic device device for your site. This means that it should be both resolution and pixel density, given that Apple (and others) click on high-resolution screens.
2018 : my approach now reduces the attributes of screen and min-device-pixel-ratio media files and uses screen size ranges. Since all devices are now registered as screen , and almost all of them have high resolution now - you really don't need these attributes. If you are on a site with a high level of traffic, perhaps they still make sense.
Here's how I lay out my breakpoints around the world:
@media (min-width: 380px) and (max-width: 480px) { } @media (min-width: 480px) and (max-width: 768px) { } @media (min-width: 768px) and (max-width: 980px) { } @media (min-width: 980px) and (max-width: 1200px) { } @media (min-width: 1200px) and (max-width: 1600px) { } @media (min-width: 1600px) { }
2012 Recommendations: I saw how this dual mandate from Chris Coyer is achieved. CSS-tricks.com: http://css-tricks.com/snippets/css/retina-display-media-query/
The concept is to create starting breakpoints based on size, and then media density queries with pixel density will follow. This approach gives you three breakpoints, and each breakpoint has a pixel density setting.
Here is a sample Coyier code (I have simplified vendor-specific prefixes so you can understand the concept):
@media only screen and (min-width: 320px) { /* Small screen, non-retina */ } @media only screen and (min-device-pixel-ratio: 2) and (min-width: 320px) { /* Small screen, retina, stuff to override above media query */ } @media only screen and (min-width: 700px) { /* Medium screen, non-retina */ } @media only screen and (min-device-pixel-ratio: 2) and (min-width: 700px) { /* Medium screen, retina, stuff to override above media query */ } @media only screen and (min-width: 1300px) { /* Large screen, non-retina */ } @media only screen and (min-device-pixel-ratio: 2) and (min-width: 1300px){ /* Large screen, retina, stuff to override above media query */ }
I really like this concept: you save bandwidth for older, most likely bandwidth limited devices, by providing the new high-resolution devices that they need. The only code you would need to place in multimedia pixel density queries should be the background image material, so higher resolution images overlap its pixelated copy on older devices.
Understand that you are trying to get into my friend’s moving target;) This is an evolving concept, css-tricks.com, stackoverflow and other blogs are the best way to keep up. Good luck.