When the unit is in pixels, round down in the leader and up in the trailer.
This commit is contained in:
parent
157c2e0518
commit
89ad638a1d
@ -104,26 +104,38 @@ $base-half-leader: $base-leader / 2;
|
|||||||
|
|
||||||
// Apply leading whitespace
|
// Apply leading whitespace
|
||||||
@mixin leader($lines: 1, $font-size: $base-font-size, $property: margin) {
|
@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) {
|
@mixin padding-leader($lines: 1, $font-size: $base-font-size) {
|
||||||
@include leader($lines, $font-size, padding);
|
@include leader($lines, $font-size, padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply leading whitespace as margin
|
||||||
@mixin margin-leader($lines: 1, $font-size: $base-font-size) {
|
@mixin margin-leader($lines: 1, $font-size: $base-font-size) {
|
||||||
@include leader($lines, $font-size, margin);
|
@include leader($lines, $font-size, margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply trailing whitespace
|
// Apply trailing whitespace
|
||||||
@mixin trailer($lines: 1, $font-size: $base-font-size, $property: margin) {
|
@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) {
|
@mixin padding-trailer($lines: 1, $font-size: $base-font-size) {
|
||||||
@include trailer($lines, $font-size, padding);
|
@include trailer($lines, $font-size, padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply trailing whitespace as margin
|
||||||
@mixin margin-trailer($lines: 1, $font-size: $base-font-size) {
|
@mixin margin-trailer($lines: 1, $font-size: $base-font-size) {
|
||||||
@include trailer($lines, $font-size, margin);
|
@include trailer($lines, $font-size, margin);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user