Skip to content

Instantly share code, notes, and snippets.

@joshuacerbito
Created August 4, 2015 07:10
Show Gist options
  • Save joshuacerbito/52a83321c96f0b0a9863 to your computer and use it in GitHub Desktop.
Save joshuacerbito/52a83321c96f0b0a9863 to your computer and use it in GitHub Desktop.
Handles font-size caculations
$base-font-size: 16px;
// Calculate rem value
@function calculateRem($size) {
$remSize: $size / $base-font-size;
@return $remSize * 1rem;
}
// Calculate Viewport-Width dependent value
@function calculateVW($size) {
$vwSize: $size / $base-font-size;
@return $vwSize * 1.2vw;
}
// Font-Size Handling
@mixin font($size, $weight: regular, $style: normal) {
font-family: $omnes;
font-size: $size;
@if $size != 'inherit' {
font-size: calculateRem($size);
}
@if $style == 'italic' {
font-style: italic;
} @else {
font-style: normal;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment