Skip to content

Instantly share code, notes, and snippets.

@starryeyez024
Last active August 29, 2015 14:01
Show Gist options
  • Save starryeyez024/3876bce41b061df2369e to your computer and use it in GitHub Desktop.
Save starryeyez024/3876bce41b061df2369e to your computer and use it in GitHub Desktop.
How to use Breakpoints effectively
<body>
<div class="test">
Test test test
</div>
</body>
/*** Breakpoints *** */
@media (min-width: 771px) {
body .test {
background: blue;
}
}
@media (max-width: 770px) {
body .test {
border: solid 2px pink;
}
}
<body>
<div class="test">
Test test test
</div>
</body>
// ----
// Sass (v3.3.7)
// Compass (v1.0.0.alpha.18)
// Breakpoint (v2.4.2)
// Singularity.gs (v1.2.1)
// ----
@import "breakpoint"
@import "compass"
@import "singularitygs"
/**** Breakpoints ****/
// For use with max-width only:
// +breakpoint(max-width: $tab-l)
$phone-p: 320px
$phone-l: 480px
$tab-p: 640px
$tab-l: 770px
$desk: 960px
// For use with min-width (default breakpoint mixin)
// +breakpoint($desktop)
$smartphone-portrait: ($phone-p + 1px)
$smartphone-landscape: ($phone-l + 1px)
$tablet-portrait: ($tab-p + 1px)
$tablet-landscape: ($tab-l + 1px)
$desktop: ($desk + 1px) , 'no-query' '.lt-ie9'
// extras
$print: 'not screen'
$hidpi: min-resolution 143dpi
$mobile: max-width $desk
//$breakpoint-to-ems: true
//*** EXAMPLE SASS CODE ****/
.test
padding: 10px
+breakpoint($tablet-landscape)
background: blue
color: white
+breakpoint(max-width $tab-l)
border: solid 2px pink
/*** Breakpoints *** */
.test {
padding: 10px;
}
@media (min-width: 771px) {
.test {
background: blue;
color: white;
}
}
@media (max-width: 770px) {
.test {
border: solid 2px pink;
}
}
<body>
<div class="test">
Test test test
</div>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment