Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. dcyoung-dev revised this gist May 30, 2022. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions css-breakpoint-mixin-vars.scss
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    @mixin for-size($range) {
    $phone-upper-boundary: 600px;
    $tablet-portrait-upper-boundary: 900px;
    $tablet-landscape-upper-boundary: 1200px;
    $desktop-upper-boundary: 1800px;
    $phone-upper-boundary: 37.5rem;
    $tablet-portrait-upper-boundary: 56.25rem;
    $tablet-landscape-upper-boundary: 75rem;
    $desktop-upper-boundary: 112.5rem;

    @if $range == phone-only {
    @media (max-width: #{$phone-upper-boundary - 1}) { @content; }
  2. @davidgilbertson davidgilbertson revised this gist Dec 29, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion css-breakpoint-mixin-vars.scss
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@
    } @else if $range == tablet-portrait-up {
    @media (min-width: $phone-upper-boundary) { @content; }
    } @else if $range == tablet-landscape-up {
    @media (min-width: $tablet-landscape-upper-boundary) { @content; }
    @media (min-width: $tablet-portrait-upper-boundary) { @content; }
    } @else if $range == desktop-up {
    @media (min-width: $tablet-landscape-upper-boundary) { @content; }
    } @else if $range == big-desktop-up {
  3. @davidgilbertson davidgilbertson revised this gist Nov 28, 2016. 1 changed file with 0 additions and 6 deletions.
    6 changes: 0 additions & 6 deletions css-breakpoint-mixin-vars.scss
    Original file line number Diff line number Diff line change
    @@ -8,16 +8,10 @@
    @media (max-width: #{$phone-upper-boundary - 1}) { @content; }
    } @else if $range == tablet-portrait-up {
    @media (min-width: $phone-upper-boundary) { @content; }
    } @else if $range == tablet-portrait-only {
    @media (min-width: $phone-upper-boundary) and (max-width: #{$tablet-portrait-upper-boundary - 1}) { @content; }
    } @else if $range == tablet-landscape-up {
    @media (min-width: $tablet-landscape-upper-boundary) { @content; }
    } @else if $range == tablet-landscape-only {
    @media (min-width: $tablet-portrait-upper-boundary) and (max-width: $tablet-landscape-upper-boundary - 1px) { @content; }
    } @else if $range == desktop-up {
    @media (min-width: $tablet-landscape-upper-boundary) { @content; }
    } @else if $range == desktop-only {
    @media (min-width: $tablet-landscape-upper-boundary) and (max-width: $desktop-upper-boundary - 1px) { @content; }
    } @else if $range == big-desktop-up {
    @media (min-width: $desktop-upper-boundary) { @content; }
    }
  4. @davidgilbertson davidgilbertson revised this gist Nov 28, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion css-breakpoint-mixin-vars.scss
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    @media (max-width: #{$phone-upper-boundary - 1}) { @content; }
    } @else if $range == tablet-portrait-up {
    @media (min-width: $phone-upper-boundary) { @content; }
    } @else if $range == tablet-portait-only {
    } @else if $range == tablet-portrait-only {
    @media (min-width: $phone-upper-boundary) and (max-width: #{$tablet-portrait-upper-boundary - 1}) { @content; }
    } @else if $range == tablet-landscape-up {
    @media (min-width: $tablet-landscape-upper-boundary) { @content; }
  5. @davidgilbertson davidgilbertson revised this gist Nov 19, 2016. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion css-breakpoint-mixin-vars.scss
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    @mixin breakpoint($range) {
    @mixin for-size($range) {
    $phone-upper-boundary: 600px;
    $tablet-portrait-upper-boundary: 900px;
    $tablet-landscape-upper-boundary: 1200px;
    @@ -21,4 +21,13 @@
    } @else if $range == big-desktop-up {
    @media (min-width: $desktop-upper-boundary) { @content; }
    }
    }

    // usage
    .my-box {
    padding: 10px;

    @include for-size(desktop-up) {
    padding: 20px;
    }
    }
  6. @davidgilbertson davidgilbertson created this gist Nov 19, 2016.
    24 changes: 24 additions & 0 deletions css-breakpoint-mixin-vars.scss
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    @mixin breakpoint($range) {
    $phone-upper-boundary: 600px;
    $tablet-portrait-upper-boundary: 900px;
    $tablet-landscape-upper-boundary: 1200px;
    $desktop-upper-boundary: 1800px;

    @if $range == phone-only {
    @media (max-width: #{$phone-upper-boundary - 1}) { @content; }
    } @else if $range == tablet-portrait-up {
    @media (min-width: $phone-upper-boundary) { @content; }
    } @else if $range == tablet-portait-only {
    @media (min-width: $phone-upper-boundary) and (max-width: #{$tablet-portrait-upper-boundary - 1}) { @content; }
    } @else if $range == tablet-landscape-up {
    @media (min-width: $tablet-landscape-upper-boundary) { @content; }
    } @else if $range == tablet-landscape-only {
    @media (min-width: $tablet-portrait-upper-boundary) and (max-width: $tablet-landscape-upper-boundary - 1px) { @content; }
    } @else if $range == desktop-up {
    @media (min-width: $tablet-landscape-upper-boundary) { @content; }
    } @else if $range == desktop-only {
    @media (min-width: $tablet-landscape-upper-boundary) and (max-width: $desktop-upper-boundary - 1px) { @content; }
    } @else if $range == big-desktop-up {
    @media (min-width: $desktop-upper-boundary) { @content; }
    }
    }