What is correct media query for IPad Pro?

前端 未结 8 1048
-上瘾入骨i
-上瘾入骨i 2020-12-23 09:32

I have these two but they are not working. I\'m simulating in Chrome

    /* Landscape*/

    @media only screen and (min-device-width: 1024px) and (max-devic         


        
8条回答
  •  醉梦人生
    2020-12-23 10:23

    I tried several of the proposed answers but the problem is that the media queries conflicted with other queries and instead of displaying the mobile CSS on the iPad Pro, it was displaying the desktop CSS. So instead of using max and min for dimensions, I used the EXACT VALUES and it works because on the iPad pro you can't resize the browser.

    Note that I added a query for mobile CSS that I use for devices with less than 900px width; feel free to remove it if needed.

    This is the query, it combines both landscape and portrait, it works for the 12.9" and if you need to target the 10.5" you can simply add the queries for these dimensions:

    @media only screen and (max-width: 900px), 
    (height: 1024px) and (width: 1366px) and (-webkit-min-device-pixel-ratio: 1.5) and (orientation: landscape), 
    (width: 1024px) and (height: 1366px) and (-webkit-min-device-pixel-ratio: 1.5) and (orientation: portrait)  {
    
         // insert mobile and iPad Pro 12.9" CSS here    
    }
    

提交回复
热议问题