Skip to content

Instantly share code, notes, and snippets.

@stevenadams
Created February 16, 2015 15:13
Show Gist options
  • Save stevenadams/8f2d3334a6813a2d4298 to your computer and use it in GitHub Desktop.
Save stevenadams/8f2d3334a6813a2d4298 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
@function strip-unit($num) {
@return $num / ($num * 0 + 1);
}
@mixin rem($property, $values...) {
$max: length($values);
$pxValues: '';
$remValues: '';
@for $i from 1 through $max {
$value: strip-unit(nth($values, $i));
$pxValues: #{$pxValues + $value}px;
@if $i < $max {
$pxValues: #{$pxValues + " "};
}
}
@for $i from 1 through $max {
$value: strip-unit(nth($values, $i));
$remValues: #{$remValues + $value / 10}rem;
@if $i < $max {
$remValues: #{$remValues + " "};
}
}
#{$property}: $pxValues;
#{$property}: $remValues;
}
html{
font-size: 62.5%;
}
body{
font-size: 1.6rem;
}
div{
@include rem(margin, 16px, 22px, 30px, 40px);
}
html {
font-size: 62.5%;
}
body {
font-size: 1.6rem;
}
div {
margin: 16px 22px 30px 40px;
margin: 1.6rem 2.2rem 3rem 4rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment