Created
July 16, 2018 10:39
-
-
Save zoxon/6959c85384ec3fd5a5c4ab64b2768ed2 to your computer and use it in GitHub Desktop.
SCSS mixins
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
@mixin clearfix { | |
&:after { | |
content: ''; | |
display: table; | |
clear: both; | |
} | |
} | |
@mixin visuallyhidden { | |
position: absolute; | |
overflow: hidden; | |
clip: rect(0 0 0 0); | |
height: 1px; | |
width: 1px; | |
margin: -1px; | |
padding: 0; | |
border: 0; | |
} | |
@mixin below($measure) { | |
@media screen and (max-width: #{$measure}) { | |
@content; | |
} | |
} | |
@mixin above($measure) { | |
@media screen and (min-width: #{$measure}) { | |
@content; | |
} | |
} | |
@function strip-unit($number) { | |
@if type-of($number) == 'number' and not unitless($number) { | |
@return $number / ($number * 0 + 1); | |
} | |
@return $number; | |
} | |
$browser-context: 16px; | |
@function em($pixels, $context: $browser-context) { | |
@return #{strip-unit($pixels) / strip-unit($context)}em; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment