Skip to content

Commit

Permalink
When the unit is in pixels, round down in the leader and up in the tr…
Browse files Browse the repository at this point in the history
…ailer.
  • Loading branch information
chriseppstein committed Jul 2, 2011
1 parent 157c2e0 commit 89ad638
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 89ad638

Please sign in to comment.