Merge pull request #848 from JohnAlbin/rhythm-offset
Add $offset parameter to rhythm() function.
This commit is contained in:
commit
0e2a5d7579
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user