Created
March 9, 2020 15:07
-
-
Save fsimmons/e9e64dc2f6f375dbe446c9994022299b to your computer and use it in GitHub Desktop.
Fluid typography SASS mixin
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
$screen_min: 320px; | |
$screen_max: 1330px; | |
@mixin fluid-type($properties, $min-vw, $max-vw, $min-value, $max-value) { | |
@each $property in $properties { | |
#{$property}: $min-value; | |
} | |
@media (min-width: $min-vw) { | |
@each $property in $properties { | |
#{$property}: calc( | |
#{$min-value} + #{strip-unit($max-value - $min-value)} * (100vw - #{$min-vw}) / #{strip-unit($max-vw - $min-vw)} | |
); | |
} | |
} | |
@media (min-width: $max-vw) { | |
@each $property in $properties { | |
#{$property}: $max-value; | |
} | |
} | |
} | |
// .text-large { | |
// @include fluid-type(font-size, $screen_min, $screen_max, 15px, 18px); | |
// @include fluid-type(line-height, $screen_min, $screen_max, 24px, 32px); | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment