Created
October 8, 2019 17:03
-
-
Save ehgoodenough/e85054ee7e6dc052e805448b8bec0b40 to your computer and use it in GitHub Desktop.
Fits your css rem into a viewport responsive aspect-ratio.
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
:root { | |
.aspect-ratio(16, 9); | |
} | |
.aspect-ratio(@width, @height) { | |
@media(min-aspect-ratio: @width ~"/" @height) { | |
font-size: ((@width / @height)* 100vh) / @width; | |
} | |
@media(max-aspect-ratio:@width ~"/" @height) { | |
font-size: ((@height / @width) * 100vw) / @height; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment