Last active
August 29, 2015 14:10
-
-
Save magicspon/88a4ad68c0ed811877f2 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$base-font-size: 16px; | |
$base-line-height: 24px; | |
@function computeLineHeight($font-size, $computed) { | |
$fs: strip-units($font-size); | |
@return $computed / $fs; | |
} | |
@function strip-units($value) { | |
@return $value / ($value * 0 + 1); | |
} | |
@mixin font-size($font-size, $line-height: true) { | |
font-size: $font-size; | |
font-size: ($font-size / $base-font-size) * 1rem; | |
@if $line-height == true { | |
line-height: ceil($font-size / $base-line-height) * ($base-line-height / $font-size); | |
} | |
@elseif $line-height != false { | |
@if type-of($line-height) == number { | |
@if unitless($line-height) { | |
line-height: computeLineHeight($font-size, $line-height); | |
} | |
} | |
// @else { @warn "the line-height value should be unitless" } | |
// @warn not supported in libsass | |
} | |
} | |
.default-vertical-rhythm { | |
@include font-size(62px); | |
} | |
.explict-line-height { | |
@include font-size(62px, 54); | |
} | |
.no-line-height { | |
@include font-size(62px, false); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.default-vertical-rhythm { | |
font-size: 62px; | |
font-size: 3.875rem; | |
line-height: 1.16129; } | |
.explict-line-height { | |
font-size: 62px; | |
font-size: 3.875rem; | |
line-height: 0.87097; } | |
.no-line-height { | |
font-size: 62px; | |
font-size: 3.875rem; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment