Browse files

When the unit is in pixels, round down in the leader and up in the tr…

…ailer.
  • Loading branch information...
1 parent 157c2e0 commit 89ad638a1d54854badd2c2d790d4757021984179 @chriseppstein chriseppstein committed Jul 1, 2011
Showing with 14 additions and 2 deletions.
  1. +14 −2 frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss
View
16 frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss
@@ -104,26 +104,38 @@ $base-half-leader: $base-leader / 2;
// Apply leading whitespace
@mixin leader($lines: 1, $font-size: $base-font-size, $property: margin) {
- #{$property}-top: rhythm($lines, $font-size);
+ $leader: rhythm($lines, $font-size);
+ @if unit($leader) == px {
+ $leader: floor($leader)
+ }
+ #{$property}-top: $leader;
}
+// Apply leading whitespace as padding
@mixin padding-leader($lines: 1, $font-size: $base-font-size) {
@include leader($lines, $font-size, padding);
}
+// Apply leading whitespace as margin
@mixin margin-leader($lines: 1, $font-size: $base-font-size) {
@include leader($lines, $font-size, margin);
}
// Apply trailing whitespace
@mixin trailer($lines: 1, $font-size: $base-font-size, $property: margin) {
- #{$property}-bottom: rhythm($lines, $font-size);
+ $leader: rhythm($lines, $font-size);
+ @if unit($leader) == px {
+ $leader: ceil($leader)
+ }
+ #{$property}-bottom: $leader;
}
+// Apply trailing whitespace as padding
@mixin padding-trailer($lines: 1, $font-size: $base-font-size) {
@include trailer($lines, $font-size, padding);
}
+// Apply trailing whitespace as margin
@mixin margin-trailer($lines: 1, $font-size: $base-font-size) {
@include trailer($lines, $font-size, margin);
}

0 comments on commit 89ad638

Please sign in to comment.