Search code examples
cssipadresponsive-designmedia-queriesdesktop

Media query min-width:1000px including iPad landscape


How can I target devices which are wider than 1000 pixels? That is, including iPad in landscape mode and most desktops but excluding iPad in portrait mode.

I have found how to target iPad specifically:

/* iPads (landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) {
/* Styles */
}

However, I would prefer if my media queries could be shaped by at what widths the content prompted layout changes rather than by specific devices.


Solution

  • If I understand your question correctly, you don't need to try and target specific devices at all.

    In your main CSS just include:

    @media (min-width: 1000px) {
    
    /* CSS styles for viewports 1000px and up */  
    
    }  
    

    and in the head of your page include

    <meta name="viewport" content="width=device-width, initial-scale=1.0">  
    

    EDIT
    Here is a working example which you can check in an iPad:
    Live: http://fiddle.jshell.net/panchroma/Bn4ah/show/
    Code view: http://fiddle.jshell.net/panchroma/Bn4ah

    Good luck!