Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Media queries for tablet min-resolution and max-resolution

Currently working on a responsive design website. I use media query for targeting different devices based on the width and screen resolution.

  1. I have a scenario were i wanted to use the screen resolution to target the devices, but i don't understand how this works.

  2. I wanted to check both min-width and max-width, with that the screen resolution may also range from 97dpi to ipad max resolution 264dpi. But this does not seems to work. If i give a single resolution min-width:155dpi for hp loaded tablet it works. But min to max resolution condition seems not working. Could you guys share your idea.

For this i have used like the below code

@media only screen and (min-width:768px) 
and (max-width:1024px) and (min-resolution:96dpi) and (max-resolution:264dpi){ 
like image 401
PCA Avatar asked Apr 10 '13 11:04

PCA


People also ask

How do you set a minimum and maximum media query?

Max-width and min-width can be used together to target a specific range of screen sizes. @media only screen and (max-width: 600px) and (min-width: 400px) {...} The query above will trigger only for screens that are 600-400px wide. This can be used to target specific devices with known widths.

What is Max width of tablet media query?

Mobile (Smartphone) max-width: 480px. Low Resolution Tablets and ipads max-width: 767px.

Should I use max width or min-width in media queries?

Generally if you are starting small screen first use min-width and then build on top with media queries targeting larger resolutions.

What is the min-width of tablet?

320px — 480px: Mobile devices. 481px — 768px: iPads, Tablets. 769px — 1024px: Small screens, laptops.


1 Answers

The resolution media query doesn't have good support in webkit browsers yet so you may have more success using device-pixel-ratio instead.

http://bjango.com/articles/min-device-pixel-ratio/

So we can restate your media query using resolution for those browsers that understand it (Firefox, IE9+, Opera), and device-pixel-ratio for all things webkit (Chrome, Safari, iOS and Android):

@media only screen and (min-resolution:96dpi) and (max-resolution:264dpi) and (min-width:768px) and (max-width:1024px),
       only screen and (-webkit-min-device-pixel-ratio: 1) and (-webkit-max-device-pixel-ratio:2) and (min-width:768px) and (max-width:1024px) {}
like image 106
thefrontender Avatar answered Oct 11 '22 01:10

thefrontender