Skip to content

Instantly share code, notes, and snippets.

@calvindavis
Created August 1, 2018 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvindavis/8367984d34731adc5ea31fed22694e64 to your computer and use it in GitHub Desktop.
Save calvindavis/8367984d34731adc5ea31fed22694e64 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
> 1%
last 2 versions
// ----
// Sass (v3.4.25)
// Compass (v1.0.3)
// ----
@mixin font-size($font-size, $line-height: null) {
font-size: $font-size;
@if $line-height != null {
@if unit($font-size) == unit($line-height) {
line-height: ($line-height / $font-size);
} @else {
line-height: $line-height;
}
}
}
.foo {
@include font-size(16px);
}
.bar {
@include font-size(16px, 20px);
}
.bar {
@include font-size(50%, 80%);
}
.quu {
@include font-size(2em, 30px);
}
.que {
@include font-size(18px, 1.5);
}
.foo {
font-size: 16px;
}
.bar {
font-size: 16px;
line-height: 1.25;
}
.bar {
font-size: 50%;
line-height: 1.6;
}
.quu {
font-size: 2em;
line-height: 30px;
}
.que {
font-size: 18px;
line-height: 1.5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment