Skip to content

Instantly share code, notes, and snippets.

@jesperlandberg
Created February 16, 2022 10:24
Show Gist options
  • Save jesperlandberg/99d50d95396c3c098c6068e32edf917c to your computer and use it in GitHub Desktop.
Save jesperlandberg/99d50d95396c3c098c6068e32edf917c to your computer and use it in GitHub Desktop.
: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