Skip to content

Instantly share code, notes, and snippets.

@Sebobo
Created November 22, 2013 13:07
Show Gist options
  • Save Sebobo/7599566 to your computer and use it in GitHub Desktop.
Save Sebobo/7599566 to your computer and use it in GitHub Desktop.
Responsive SASS
$page-width: 970px;
$mobile: "only screen and (max-width: #{$page-width})";
// As mixin
@mixin mobile() {
@media #{$mobile} {
@content;
}
}
// Using the mixin
.responsive-block-a {
background-color: red;
padding-left: 70px;
@include mobile {
padding-left: 0;
background-color: blue;
.foo {
color: black;
}
}
}
// Using the media query
.responsive-block-b {
background-color: red;
padding-left: 70px;
@media #{$mobile} {
padding-left: 0;
background-color: blue;
.foo {
color: black;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment