Skip to content

Instantly share code, notes, and snippets.

@imtapps
Created March 3, 2014 15:16
Show Gist options
  • Save imtapps/9327104 to your computer and use it in GitHub Desktop.
Save imtapps/9327104 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Media Query Example</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="main-content">
<div class="container">
<p class="big-thing">Visiable from 1200px and above</p>
<p class="med-thing">Visiable between 481 to 1199px</p>
<p class="sm-thing">Visiable up to 480px</p>
</div>
<div class='container big-thing'><p>Are you building a product?</p></div>
<div class='container med-thing'><p>Tablets</p></div>
<div class='container sm-thing'><p>Mobile Phones</p></div>
</div>
</body>
</html>
body {
background-color: #FCF9F9;
}
.container {
border: 3px solid #3E3E3E;
border-radius: 5px;
margin: 0 0 10px 0;
padding: 0 0 0 15px;
}
.big-thing, .med-thing, .sm-thing {
display: none;
}
/* -- Smartphones (portrait and landscape) -- */
@media (max-width : 480px) {
.sm-thing {
display: block;
}
.container {
background-color: #FCF8E3;
}
}
/* -- iPads (portrait and landscape) -- */
@media (min-width : 481px) and (max-width : 1199px) {
.med-thing {
display: block;
}
.container {
background-color: #DFF0D8;
}
}
/* -- Desktops and laptops -- */
@media (min-width : 1200px) {
.big-thing {
display: block;
}
.container {
background-color: #D9EDF7;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment