Skip to content

Instantly share code, notes, and snippets.

@chrisbuttery
Created July 17, 2012 04:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisbuttery/3127209 to your computer and use it in GitHub Desktop.
Save chrisbuttery/3127209 to your computer and use it in GitHub Desktop.
MQs just to target smart phones
<html>
<head>
<!-- make sure you have this meta tag in your html -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
/* General styles */
#body {
margin: 0 auto;
width: 960px;
}
.header {
background: red;
color: white;
display: block;
font-size: 13px;
}
/* Smartphones (portrait and landscape) ----------- */
@media only screen and (min-width : 320px) and (max-width : 480px) {
/* Styles */
body {
background: red;
}
#body {
width: 90%;
}
.header {
background: blue;
color: yellow;
}
}
</style>
</head>
<body>
<div id="body">
<div class="header">
<h1>Header</h1>
</div>
<div class="content">
<p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed posuere consectetur est at lobortis. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment