Last active
August 29, 2015 14:14
-
-
Save thomasthesecond/567fce1b07911706b292 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Sass Breakpoints</title> | |
</head> | |
<body> | |
<div></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.9) | |
// Compass (v1.0.1) | |
// Bourbon (v4.0.2) | |
// Neat (v1.6.0) | |
// ---- | |
@import "bourbon/bourbon"; | |
@import "bourbon/bourbon"; | |
@import "neat/neat"; | |
/** | |
* Settings | |
* -------- | |
*/ | |
$is-testing: true; | |
$em-base: 16px !default; | |
$breakpoints: ( | |
'screen': ( | |
'xl': em(1200px), | |
'l-max': em(1200px - 1px), | |
'l': em(870px), | |
'm-max': em(870px - 1px), | |
'm': em(640px), | |
's-max': em(640px - 1px), | |
's': em(480px), | |
'xs-max': em(480px - 1px), | |
'xs': em(320px) | |
), | |
'component': ( | |
'header-nav': em(750px), | |
'article-sidebar': em(900px) | |
) | |
) !global; | |
/** | |
* Functions | |
* --------- | |
*/ | |
@function strip-units($val) { | |
@return ($val / ($val * 0 + 1)); | |
} | |
@function em($px, $base: $em-base) { | |
@return ($px / $base) * 1em; | |
} | |
@function break($type, $name) { | |
@return map-get(map-get($breakpoints, $type), $name); | |
} | |
/** | |
* Layout Indicator | |
* ---------------- | |
*/ | |
@if $is-testing == true { | |
body:before { | |
background: rgba(red, .5); | |
bottom: 0; | |
color: white; | |
content: ''; | |
display: block; | |
font-size: 12px; | |
left: 0; | |
line-height: 1; | |
padding: 10px 20px; | |
position: fixed; | |
z-index: 100; | |
@each $type, $types in $breakpoints { | |
@each $name, $value in $types { | |
@include media(break($type, $name)) { | |
$px: strip-units(break($type, $name)) * $em-base; | |
content: '#{$type, $name} (#{$px})'; | |
} | |
} | |
} | |
} | |
} | |
/** | |
* Styles | |
* ------ | |
*/ | |
div { | |
@include size(100px); | |
background-color: black; | |
@include media(break(screen, s)) { | |
background-color: red; | |
width: 200px; | |
} | |
@include media(break(screen, m)) { | |
background-color: orange; | |
width: 300px; | |
} | |
@include media(break(screen, l)) { | |
background-color: green; | |
width: 400px; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
} | |
/** | |
* Settings | |
* -------- | |
*/ | |
/** | |
* Functions | |
* --------- | |
*/ | |
/** | |
* Layout Indicator | |
* ---------------- | |
*/ | |
body:before { | |
background: rgba(255, 0, 0, 0.5); | |
bottom: 0; | |
color: white; | |
content: ''; | |
display: block; | |
font-size: 12px; | |
left: 0; | |
line-height: 1; | |
padding: 10px 20px; | |
position: fixed; | |
z-index: 100; | |
} | |
@media screen and (min-width: 75em) { | |
body:before { | |
content: "screen, xl (1200px)"; | |
} | |
} | |
@media screen and (min-width: 74.9375em) { | |
body:before { | |
content: "screen, l-max (1199px)"; | |
} | |
} | |
@media screen and (min-width: 54.375em) { | |
body:before { | |
content: "screen, l (870px)"; | |
} | |
} | |
@media screen and (min-width: 54.3125em) { | |
body:before { | |
content: "screen, m-max (869px)"; | |
} | |
} | |
@media screen and (min-width: 40em) { | |
body:before { | |
content: "screen, m (640px)"; | |
} | |
} | |
@media screen and (min-width: 39.9375em) { | |
body:before { | |
content: "screen, s-max (639px)"; | |
} | |
} | |
@media screen and (min-width: 30em) { | |
body:before { | |
content: "screen, s (480px)"; | |
} | |
} | |
@media screen and (min-width: 29.9375em) { | |
body:before { | |
content: "screen, xs-max (479px)"; | |
} | |
} | |
@media screen and (min-width: 20em) { | |
body:before { | |
content: "screen, xs (320px)"; | |
} | |
} | |
@media screen and (min-width: 46.875em) { | |
body:before { | |
content: "component, header-nav (750px)"; | |
} | |
} | |
@media screen and (min-width: 56.25em) { | |
body:before { | |
content: "component, article-sidebar (900px)"; | |
} | |
} | |
/** | |
* Styles | |
* ------ | |
*/ | |
div { | |
height: 100px; | |
width: 100px; | |
background-color: black; | |
} | |
@media screen and (min-width: 30em) { | |
div { | |
background-color: red; | |
width: 200px; | |
} | |
} | |
@media screen and (min-width: 40em) { | |
div { | |
background-color: orange; | |
width: 300px; | |
} | |
} | |
@media screen and (min-width: 54.375em) { | |
div { | |
background-color: green; | |
width: 400px; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Sass Breakpoints</title> | |
</head> | |
<body> | |
<div></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment