Created
October 20, 2018 20:49
-
-
Save JawsomeJason/1400133dddd18d76fbe86cffc5f27b09 to your computer and use it in GitHub Desktop.
LESS Mixin to easily create fluid typography based on viewport information
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
// see https://css-tricks.com/snippets/css/fluid-typography/ for 🤯 | |
.viewport-fluid(@property, @from, @to, @screen-min: @screen-sm, @screen-max: @screen-lg, @viewport-unit: vw) { | |
@{property}: @from; | |
@media (min-width: @screen-min) { | |
@{property}: calc( | |
@from + unit(@to - @from) * ((~"100@{viewport-unit}" - @screen-min) / unit(@screen-max - @screen-min)) | |
); | |
} | |
@media (min-width: @screen-max) { | |
@{property}: @to; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment