Created
December 14, 2012 15:14
-
-
Save pavenuto/4286155 to your computer and use it in GitHub Desktop.
Note: the font-size: 62.5% thing on the html element is for switching to base 10 for the ease of calculations (default 16px * 62.5 / 100 = 10). From there, it’s easy to say 1.3rem + 13px.
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
.font-size($pxValue){ | |
@remValue: (@pxValue / 10); | |
font-size: ~"@{pxValue}px"; | |
font-size: ~"@{remValue}rem"; | |
} | |
html { font-size: 62.5%; } | |
.my-element { | |
.font-size(13px); | |
} | |
/* Output CSS */ | |
.my-element { | |
font-size: 13px; /* Internet Explorer 6/7/8 + Opera Mini */ | |
font-size: 1.3rem; /* Other browsers */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment