Skip to content

Instantly share code, notes, and snippets.

@fredDesign
Forked from sveetch/fittext.scss
Created February 5, 2013 11:22
Show Gist options
  • Save fredDesign/4713840 to your computer and use it in GitHub Desktop.
Save fredDesign/4713840 to your computer and use it in GitHub Desktop.
// Strip unit from a number value
// Usage :
// strip-units(16px);
// Will return "16" (as a number)
@function strip-units($number) {
@return $number / ($number * 0 + 1);
}
// Usage :
// $resos: $screenSmall, $screenMedium, $screenXlarge;
// @include fit-text(5.2px, $resos);
//
@mixin fit-text($baseFontSize, $resolutions, $start: 1920, $ratio: 0.0075) {
font-size: $baseFontSize*($start * $ratio);
@each $breakpointItem in $resolutions {
@media (max-width: $breakpointItem - 1) {
font-size: $baseFontSize*(strip-units($breakpointItem)*$ratio);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment