Skip to content

Instantly share code, notes, and snippets.

@kevinmarx
Created November 9, 2012 20:18
Show Gist options
  • Save kevinmarx/4047973 to your computer and use it in GitHub Desktop.
Save kevinmarx/4047973 to your computer and use it in GitHub Desktop.
Auto generate pixel fallback when using root-ems
@mixin use-rems($property, $size1, $size2:null, $size3:null, $size4:null) {
@if ($size4) {
#{$property}: $size1+px $size2+px $size3+px $size4+px;
#{$property}: ($size1/10)+rem ($size2/10)+rem ($size3/10)+rem ($size4/10)+rem;
} @else if ($size3) {
#{$property}: $size1+px $size2+px $size3+px;
#{$property}: ($size1/10)+rem ($size2/10)+rem ($size3/10)+rem;
} @else if ($size2) {
#{$property}: $size1+px $size2+px;
#{$property}: ($size1/10)+rem ($size2/10)+rem;
} @else {
#{$property}: $size1+px;
#{$property}: ($size1/10)+rem;
}
}
@kevinmarx
Copy link
Author

Requires sass 3.2

@kevinmarx
Copy link
Author

Also assumes that you are setting your base size to 62.5%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment