Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fits your css rem into a viewport responsive aspect-ratio.
: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
You can’t perform that action at this time.