Created
August 26, 2016 14:32
-
-
Save jmahc/aa94d8e25c5138ee312ec569c10b7bb0 to your computer and use it in GitHub Desktop.
LESS Repsonsive Typography
This file contains hidden or 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
@min_width: 400; | |
@max_width: 800; | |
@min_font: 12; | |
@max_font: 24; | |
@min_width-px: unit(@min_width, px); | |
@max_width-px: unit(@max_width,px); | |
@min_font-px: @min_font * 1px; | |
@max_font-px: @max_font * 1px; | |
:root { | |
font-size: @min_font * 1px; | |
} | |
@media (min-width: @min_width-px) and (max-width: @max_width-px){ | |
:root { | |
font-size: ~"calc( @{min_font-px} + (@{max_font} - @{min_font}) * ( (100vw - @{min_width-px}) / ( @{max_width} - @{min_width}) ))"; | |
} | |
} | |
@media (min-width: @max_width-px){ | |
:root { | |
font-size: @max_font-px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment