Created
February 16, 2022 10:24
-
-
Save jesperlandberg/99d50d95396c3c098c6068e32edf917c to your computer and use it in GitHub Desktop.
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{ | |
--size: 375; | |
} | |
@media (min-width: 769px) { | |
:root{ | |
--size: 1440; | |
} | |
} | |
@mixin fluid($properties, $value) { | |
@each $property in $properties { | |
#{$property}: calc(#{$value} * (100vw / var(--size))); | |
} | |
} | |
html{ | |
@include fluid(font-size, 10); | |
} | |
/* | |
Since I use a fluid html font size, based on the screen width, | |
everything that uses REM units will scale perfectly with the size of the screen. | |
*/ | |
.something{ | |
font-size: 1rem; | |
margin: 1rem; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment