title: Target mobile devices with CSS (iPad, iPhone) but exclude non-mobile devices
body: <p>I'm trying to target mobile devices (specifically the iPad and iPhone) but using CSS3 media queries the same styling is added to other devices with the same resolution, such as laptops. How can I add mobile device specific styling without adding it to other non-mobile devices too?</p>
  
  <p>So far I'm using this, which adds the css to all devices that are 1024px wide and under, even with the orientation selector:</p>
  
  <pre><code>@media only screen and (min-device-width: 320px) and (orientation:portrait),
                         (max-device-width: 1024px) and (orientation:landscape){
             // Do something
  }
  </code></pre>
  
  <p><strong>EDIT:</strong>
  For anyone interested, I got this to work just by duplicating the media query but altering the duplicate slightly. It's by far the most efficient way of doing it but the main thing is it works:</p>
  
  <pre><code>@media only screen and (min-device-width: 320px) and (orientation:portrait),
                     (max-device-width: 1024px) and (orientation:landscape){
         // some styling
  }
  
  @media only screen and (min-device-width: 320px) and (orientation:portrait),
                     (max-device-width: 768px) and (orientation:portrait){
         // some styling
  }
  </code></pre>