Skip to content

Instantly share code, notes, and snippets.

@stackpoet
Forked from ijy/Compass px to em
Created March 31, 2014 19:02
Show Gist options
  • Save stackpoet/9899683 to your computer and use it in GitHub Desktop.
Save stackpoet/9899683 to your computer and use it in GitHub Desktop.

Revisions

  1. Ian Young revised this gist Dec 7, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Compass px to em
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    @function em($target, $context: $font-base) {
    @function em($target, $context: $base-font-size) {
    @if $target == 0 { @return 0 }
    @return $target / $context + 0em;
    }
  2. Ian Young created this gist Dec 7, 2011.
    10 changes: 10 additions & 0 deletions Compass px to em
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    @function em($target, $context: $font-base) {
    @if $target == 0 { @return 0 }
    @return $target / $context + 0em;
    }

    $base-font-size: 15px;

    h1 {
    font-size: em(21px, 15px); // Outputs 1.4em
    }