Created
August 13, 2015 12:09
-
-
Save Simounet/0d425476531dcf6cc304 to your computer and use it in GitHub Desktop.
Relative font size Compass mixin
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
@mixin relative-font-size( $px-size, $unit: 'rem', $context: $base-font-size ) { | |
@if $px-size == 0 { | |
@error "$px-size value can't be equalse to 0."; | |
} | |
@if unit( $px-size ) != "px" { | |
@error "$px-size must be value in pixels." | |
} | |
@if $unit != 'rem' | |
and $unit != 'em' | |
and $unit != '%' { | |
@error "$unit must be 'rem' or 'em' or '%'."; | |
} | |
font-size: $px-size; | |
font-size: $px-size / $context + 0#{$unit}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment