Skip to content

Instantly share code, notes, and snippets.

@eriku
Created February 24, 2015 20:21
Show Gist options
  • Save eriku/54b3c5cd9678fdb92841 to your computer and use it in GitHub Desktop.
Save eriku/54b3c5cd9678fdb92841 to your computer and use it in GitHub Desktop.
SCSS Breakpoint Mixin
%h2.page-title Something Interesting
@import "compass/css3";
$breakpoint-desktop: 1080px;
$breakpoint-tablet: 800px;
$breakpoint-mobile: 600px;
// Breakpoint mixin
@mixin breakpoint($point, $first: 'max') {
$bp: '';
@if $point == desktop {
$bp: $breakpoint-desktop;
} @else if $point == tablet {
$bp: $breakpoint-tablet;
} @else {
$bp: $breakpoint-mobile;
}
@if $first == min {
$bp: $bp + 1;
}
@media screen and ($first + '-width:' + $bp) { @content ; }
}
.page-title {
color: black;
font-size: 16px;
@include breakpoint(desktop, min) {
font-size: 50px;
}
@include breakpoint(tablet) {
color: red;
}
@include breakpoint(mobile) {
color: HotPink;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment