Skip to content

Instantly share code, notes, and snippets.

@csilverman
Created August 17, 2021 20:35
Show Gist options
  • Save csilverman/0aa5877e249b7c3339322973d2fb645b to your computer and use it in GitHub Desktop.
Save csilverman/0aa5877e249b7c3339322973d2fb645b to your computer and use it in GitHub Desktop.
/// Rem output with px fallback.
///
/// @group Typography
/// @author Adam Laki
///
/// @param {Number} $sizeValue - Element's font size
/// @output `font-size` with fallback
///
/// @example scss - Set rem font-size to `.foo`
/// .foo {
/// @include font-size(1.2);
/// }
@mixin font-size($sizeValue: 1) {
font-size: ($sizeValue * 16) * 1px;
font-size: $sizeValue * 1rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment