Created
April 23, 2016 20:25
-
-
Save denised/14f8b4c99a3125d52730b86efa5cce0f to your computer and use it in GitHub Desktop.
Simple Sass mixin for responsive css: start height / width / margin / font-size/etc. at one size, and shrink when the screen is smaller.
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
/* | |
* Set a measure to a standard size on large screens, | |
* and beneath 750 pixels width, scale it according to screen width. | |
* Useful for margins, padding, font-sizes: anything which takes a measure. | |
* Works with absolute measures (px, pt, etc., also rem), not | |
* with relative measures (em, etc.) | |
* | |
* Usage: | |
* foo { | |
* @include responsive-measure(margin,20px); | |
* } | |
*/ | |
@mixin responsive-measure($measure,$basis) { | |
#{$measure}: $basis; | |
@media (max-width: 749px) { | |
$unitless: $basis / (0 * $basis + 1); | |
#{$measure}: $unitless * 0.1333vw; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment