Skip to content

Instantly share code, notes, and snippets.

@rwillrich
Last active December 11, 2015 06:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwillrich/4557000 to your computer and use it in GitHub Desktop.
Save rwillrich/4557000 to your computer and use it in GitHub Desktop.
Mixin that uses some Compass functions to fix vertical rhythm based on a fixed height and a font size.
@mixin fix-vertical-rhythm($height, $font-size: $base-font-size, $padding: true) {
@if $height > 0 {
$lines: lines-for-font-size($height);
$offset: rhythm($lines, $font-size, $height) / 2;
@if $padding {
padding-top: $offset;
padding-bottom: $offset;
}
@else {
margin-top: $offset;
margin-bottom: $offset;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment