Skip to content

Instantly share code, notes, and snippets.

@AquiTCD
Last active October 28, 2016 00:42
Show Gist options
  • Save AquiTCD/d7d663cdf098b26e14b5feade1ef1724 to your computer and use it in GitHub Desktop.
Save AquiTCD/d7d663cdf098b26e14b5feade1ef1724 to your computer and use it in GitHub Desktop.
Vertical InRitsu Mixin inspired Vertical Rhythm and Modular Scale
//============================================================
// Vertical InRitsu Mixin inspired Vertical Rhythm and Modular Scale
// NOTICE: need to load pow function before
// ref: https://css-tricks.com/snippets/sass/power-function/
//============================================================
=vertical-inritsu($in-scale: 0, $with-margin-top: 1, $with-margin-bottom: 1, $with-padding-top: 0, $with-padding-bottom: 0)
$base-font-size: 1rem !default
$base-ratio: 1.414 !default
$in-fz: $base-font-size * pow($base-ratio, ($in-scale / 4))
$in-base-unit: ($base-font-size * pow($base-ratio, 2)/ 4)
$in-lh: $in-base-unit
@while ($in-lh - $in-fz) < $in-base-unit
$in-lh: $in-lh + $in-base-unit
font-size: $in-fz
line-height: $in-lh
margin-top: ($in-base-unit * 4) * $with-margin-top
margin-bottom: ($in-base-unit * 4) * $with-margin-bottom
padding-top: ($in-base-unit * 4) * $with-padding-top
padding-bottom: ($in-base-unit * 4) * $with-padding-bottom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment