Skip to content

Instantly share code, notes, and snippets.

@tyssen
Last active August 29, 2015 14:00
Show Gist options
  • Save tyssen/11249562 to your computer and use it in GitHub Desktop.
Save tyssen/11249562 to your computer and use it in GitHub Desktop.
Using SASS for creating mediaqueries
#content {
background-color: #fff;
clear: both;
overflow: hidden;
padding: 20px;
@include breakpoint(600) {
border: 2px solid $color1;
}
}
[role=main] {
position: relative;
@include breakpoint(720) {
.two-col & {
float: left;
width: 720px;
}
.home & {
width: 50%
}
}
}
[role=complementary] {
box-sizing: border-box;
@include breakpoint(720) {
.two-col & {
float: right;
width: 200px;
}
.home & {
padding-left: 40px;
width: 50%;
}
}
}
// Breakpoint mixin
$old-ie: false !default;
@mixin breakpoint($point) {
@if $old-ie {
@content;
}
@else {
@media only screen and (min-width: $point / 16 * 1em) {
@content;
}
}
}
// Main stylesheet
@charset "UTF-8";
@import 'master';
// Old IE stylesheet
@charset "UTF-8";
$old-ie: true;
@import 'master';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment