Skip to content

Instantly share code, notes, and snippets.

@intermundos
Last active April 19, 2017 04:05
Show Gist options
  • Select an option

  • Save intermundos/85d71a1f84979ef03c23da1db97fa884 to your computer and use it in GitHub Desktop.

Select an option

Save intermundos/85d71a1f84979ef03c23da1db97fa884 to your computer and use it in GitHub Desktop.
$mq-324: 324px;
$mq-768: 768px;
$mq-1024: 1024px;
$mq-1200: 1200px;
$mq-1600: 1600px;
@function between($to, $from, $toWidth, $fromWidth) {
$slope: ($to - $from) / ($toWidth - $fromWidth);
$base: $from - $slope * $fromWidth;
@return calc(#{$base} + #{100vw * $slope});
}
@mixin between($property, $from, $to, $fromWidth, $toWidth) {
#{$property}: $to;
@media screen and (min-width: $toWidth){
#{$property}: between($to, $from, $toWidth, $fromWidth);
}
@media screen and (min-width: $fromWidth) {
#{$property}: $from;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment