Created
September 4, 2012 19:49
-
-
Save Traxmaxx/3625600 to your computer and use it in GitHub Desktop.
rem unit mixin for SASS 3
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
//Add pixel units for old browsers. The base for rem is 10. HTML font-size have to be 62.5%/20pt | |
@mixin font-size($val: 1.2, $important: false){ | |
@if $important == true { | |
font-size: ($val * 10) + px !important; | |
font-size: $val + rem !important; | |
} | |
@else { | |
font-size: ($val * 10) + px; | |
font-size: $val + rem; | |
} | |
} | |
//Do the same with line-height. If only the font-size is given, we set the line-height 1.5 as big as the font-size. You can override this behavior by passing a 2nd param | |
@mixin line-height($font:1.2, $line: $font * 1.5, $important: false){ | |
@if $important == true { | |
line-height: ($line * 10) + px !important; | |
line-height: $line + rem !important; | |
} | |
@else { | |
line-height: ($line * 10) + px; | |
line-height: $line + rem; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment