Skip to content

Instantly share code, notes, and snippets.

@lunelson
Last active December 16, 2015 22:39
Show Gist options
  • Save lunelson/5508982 to your computer and use it in GitHub Desktop.
Save lunelson/5508982 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com, the Sass playground.
// fiddling with auto conversion between rem and px
$base-font-size: 10px;
@function rem($n) {
@if unitless($n) {
@return $n * 1rem;
}
@else if unit($n) == 'px' {
@return $n / $base-font-size * 1rem;
} @else {
@return $n;
}
}
$mobile: 48rem; //480px
.test {
@include breakpoint($mobile) {
width: rem(100px);
}
}
@media (min-width: 48rem) {
.test {
width: 10rem;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment