Skip to content

Instantly share code, notes, and snippets.

@tjFogarty
Created February 25, 2016 16:18

Revisions

  1. tjFogarty created this gist Feb 25, 2016.
    1 change: 1 addition & 0 deletions SassMeister-input-HTML.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <h1>This should be a responsive heading title right here</h1>
    20 changes: 20 additions & 0 deletions SassMeister-input.scss
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    // ----
    // libsass (v3.2.5)
    // ----

    @function strip-unit($number) {
    @if type-of($number) == 'number' and not unitless($number) {
    @return $number / ($number * 0 + 1);
    }

    @return $number;
    }

    @mixin responsive-text($min-font-size, $max-font-size, $min-screen-width, $max-screen-width) {
    font-size: calc(#{$min-font-size} + #{strip-unit($max-font-size - $min-font-size)} * ((100vw - #{$min-screen-width}) / #{strip-unit($max-screen-width - $min-screen-width)}));
    }

    h1 {
    @include responsive-text(20px, 60px, 600px, 1920px);
    font-family: sans-serif;
    }
    4 changes: 4 additions & 0 deletions SassMeister-output.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    h1 {
    font-size: calc(20px + 40 * ((100vw - 600px) / 1320));
    font-family: sans-serif;
    }
    1 change: 1 addition & 0 deletions SassMeister-rendered.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <h1>This should be a responsive heading title right here</h1>