Skip to content

Instantly share code, notes, and snippets.

@Bachana123
Last active November 20, 2019 13:21
Show Gist options
  • Save Bachana123/0423828448a7d69fe651b1997f1b1679 to your computer and use it in GitHub Desktop.
Save Bachana123/0423828448a7d69fe651b1997f1b1679 to your computer and use it in GitHub Desktop.

responsive-font-mixin

@author Bachana Papunashvili

responsive font @mixin for scss

@example @include responsive-font(14, 30, 320, 1600);

//
// responsive font
/// @author Bachana Papunashvili
/// @param min-font-size minimal font size on your page
/// @param max-font-size  maximal font size on your page
/// @param min-width  min width of your page
/// @param max-width  max width of your page
/// @example  @include responsive-font(14, 30, 320, 1600);

@mixin responsive-font($min-font-size, $max-font-size, $min-width: 320, $max-width: 1600) {
  font-size: calc(#{$min-font-size}px + (#{$max-font-size} - #{$min-font-size}) * ((100vw - #{$min-width}px) / (#{$max-width} - #{$min-width})));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment