Skip to content

Instantly share code, notes, and snippets.

@bpainter
Created April 16, 2013 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bpainter/5395419 to your computer and use it in GitHub Desktop.
Save bpainter/5395419 to your computer and use it in GitHub Desktop.
A CodePen by Bermon Painter. Media Queries
<h1>Media Queries</h1>
<p>One of the nice things that Sass will let you do with media queries is nest them. This helps keep like sections of CSS chunked together and easier to maintain.</p>
<article role="main">
Main content
</article>
<aside role="complementary">
Secondary content
</aside>
@import "compass";
h1 {
font-size: 20px;
}
article, aside {
background-color: #ccc;
margin-bottom: 20px;
min-height: 80px;
}
$small-breakpoint: 480px;
$medium-breakpoint: 768px;
$large-breakpoint: 1024px;
article {
width: 100%;
@media screen and (min-width: $small-breakpoint) {
background-color: #999;
float: left;
width: 70%;
}
@media screen and (min-width: $medium-breakpoint) {
background-color: #666;
width: 60%;
}
@media screen and (min-width: $large-breakpoint) {
background-color: #333;
width: 48%;
}
}
aside {
width: 100%;
@media screen and (min-width: $small-breakpoint) {
background-color: #999;
float: right;
width: 25%;
}
@media screen and (min-width: $medium-breakpoint) {
background-color: #666;
width: 35%;
}
@media screen and (min-width: $large-breakpoint) {
background-color: #333;
width: 48%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment