Skip to content

Instantly share code, notes, and snippets.

@Lobstrosity
Created August 10, 2011 00:58
Show Gist options
  • Save Lobstrosity/1135710 to your computer and use it in GitHub Desktop.
Save Lobstrosity/1135710 to your computer and use it in GitHub Desktop.
CSS Media Queries
<head>
<link rel="stylesheet" href="base.css" />
<link rel="stylesheet" href="mobile.css" media="max-width: 320px" />
<!-- OR -->
<style type="text/css">
/* base styles go here */
@media (max-width: 320px)
{
/* mobile styles go here */
}
</style>
</head>
<!-- Common styles -->
<link rel="stylesheet" href="base.css" />
<!-- For tiny (most likely mobile) browsers -->
<link rel="stylesheet" href="small.css" media="max-width: 320px" />
<!-- For small desktop or large mobile browsers -->
<link rel="stylesheet" href="medium.css"
media="min-width: 321px and max-width: 799px" />
<!-- Most desktop browsers -->
<link rel="stylesheet" href="large.css" media="min-width: 800px" />
<meta name="viewport" content="width=device-width" />
#wrapper
{
-webkit-transition: width 0.2s ease-in-out;
-moz-transition: width 0.2s ease-in-out;
-o-transition: width 0.2s ease-in-out;
transition: width 0.2s ease-in-out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment