Skip to content
Browse files

Add $offset parameter to rhythm() function.

  • Loading branch information...
1 parent c00ae82 commit c5041fbcb9a1a06c95f8e1b1d05201e492afb875 @JohnAlbin committed Apr 14, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss
View
9 frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss
@@ -111,12 +111,13 @@ $base-half-leader: $base-leader / 2;
// Calculate rhythm units.
@function rhythm(
$lines: 1,
- $font-size: $base-font-size
+ $font-size: $base-font-size,
+ $offset: 0
) {
@if not $relative-font-sizing and $font-size != $base-font-size {
@warn "$relative-font-sizing is false but a relative font size was passed to the rhythm function";
}
- $rhythm: $font-unit * $lines * $base-line-height / $font-size;
+ $rhythm: $font-unit * ($lines * $base-line-height - $offset) / $font-size;
// Round the pixels down to nearest integer.
@if unit($rhythm) == px {
$rhythm: floor($rhythm);
@@ -183,7 +184,7 @@ $base-half-leader: $base-leader / 2;
style: $border-style;
width: $font-unit * $width / $font-size;
};
- padding-#{$side}: $font-unit / $font-size * ($lines * $base-line-height - $width);
+ padding-#{$side}: rhythm($lines, $font-size, $offset: $width);
}
// Apply borders and whitespace equally to all sides.
@@ -195,7 +196,7 @@ $base-half-leader: $base-leader / 2;
style: $border-style;
width: $font-unit * $width / $font-size;
};
- padding: $font-unit / $font-size * ($lines * $base-line-height - $width);
+ padding: rhythm($lines, $font-size, $offset: $width);
}
// Apply a leading border.

0 comments on commit c5041fb

Please sign in to comment.
Something went wrong with that request. Please try again.