Last active
October 30, 2016 11:16
-
-
Save webbingstudio/a409a38d17f647389454822a640e4c0d to your computer and use it in GitHub Desktop.
ボックスの文字サイズと行間を反映した上下余白をremで返すmixin ref: http://qiita.com/webbingstudio@github/items/b607869bedec12eea961
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// px高さと文字サイズから必要な余白を計算し、remで返す | |
@mixin box-spacing( $height: 30, $font-size: 16, $line-height: 1.35, $border-top: 0, $border-bottom: 0, $rem: 16 ) { | |
padding-top: ( ( ( $height - ( $border-top + $border-bottom ) - ( $font-size * $line-height ) ) / 2 ) / $rem ) * 1rem; | |
padding-bottom: ( ( ( $height - ( $border-top + $border-bottom ) - ( $font-size * $line-height ) ) / 2 ) / $rem ) * 1rem; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.example { | |
@include box-spacing( 44, 16, 1.5, 3, 3 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment