Created
March 25, 2015 17:49
-
-
Save MichaelArestad/e1d32c7127b545e7f714 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or 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
// ---- | |
// Sass (v3.4.12) | |
// Compass (v1.0.3) | |
// ---- | |
// ========================================================================== | |
// Typography variables | |
// ========================================================================== | |
$root-font-size: 20px; | |
// ========================================================================== | |
// Typography functions | |
// ========================================================================== | |
// em() function | |
// Convert px to em in a readable fashion. | |
// Examples: | |
// 1. font-size: em(14px); | |
// 2. font-size: em(30px/14px); | |
@function em( $value, $context: $root-font-size ) { | |
@if variable-exists( em ) { | |
@return ( $value / $em * 1em ); | |
} @else { | |
@return ( $value / $context * 1em ); | |
} | |
} | |
// ========================================================================== | |
// Typography | |
// ========================================================================== | |
.without-variable { | |
font-size: em( 15px ); | |
line-height: em( 30px, 15px ); | |
} | |
.with-variable { | |
$em: 15px !global; | |
font-size: em( $em ); | |
line-height: em( 30px ); | |
} |
This file contains hidden or 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
.without-variable { | |
font-size: 0.75em; | |
line-height: 2em; | |
} | |
.with-variable { | |
font-size: 1em; | |
line-height: 2em; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment