Skip to content

Instantly share code, notes, and snippets.

@danott
Created February 21, 2011 15:44
Show Gist options
  • Select an option

  • Save danott/837231 to your computer and use it in GitHub Desktop.

Select an option

Save danott/837231 to your computer and use it in GitHub Desktop.
Target specific touch devices with media queries.
@media only screen and (max-width: 999px) {
/* rules that only apply for canvases narrower than 1000px */
}
@media only screen and (device-width: 768px) and (orientation: landscape) {
/* rules for iPad in landscape orientation */
}
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
/* iPhone, Android rules here */
}
@media only screen and (min-device-pixel-ratio: 2) {
/* iPhone4 */
}
@blakeperdue

Copy link
Copy Markdown

I don't think the iPhone4 query works anymore now that there are macbooks with device pixel ratios of 2 (ie, retina display macbook).

@jpdevries

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment