-
-
Save JodiWarren/4698674 to your computer and use it in GitHub Desktop.
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
/* | |
Following this suggestion by @aral: | |
https://twitter.com/#!/aral/status/161833507423916032 and | |
https://twitter.com/#!/aral/status/161833979736096769 | |
I realised that a CSS Pre-processor could help save some time here if you | |
use the same values for px and rem. | |
This works in SCSS: | |
*/ | |
@mixin font_size($size) { | |
font-size: #{$size}px; | |
font-size: #{$size}rem; | |
} | |
/* Usage | |
*/ | |
html { | |
font-size: 1px; | |
} | |
body { | |
@include font_size(16); // 16px/rem | |
} | |
h1 { | |
@include font_size(24); // 24px/rem | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment