reuse top calculation to find vertical center

This commit is contained in:
Kevin Ross 2015-12-15 18:18:32 -06:00
parent e04df20616
commit cd91af205e
4 changed files with 11 additions and 5 deletions

View File

@ -5,7 +5,7 @@ label.radio-inline {
span {
position: absolute;
top: (($line-height * $font-size-base) - $mdb-radio-size) / 2; // vertical center of line-height
top: calc-top($line-height, $font-size-base, $mdb-radio-size); // vertical center of line-height
left: 0;
display: inline-block;
width: $mdb-radio-size;

View File

@ -6,7 +6,7 @@
.mdb-switch-track {
position: absolute;
top: 0;
top: calc-top($line-height, $font-size-base, $mdb-switch-height);
left: 0;
display: inline-block;
width: $mdb-switch-width;

View File

@ -147,7 +147,8 @@
.radio label,
label.radio-inline,
.checkbox label,
label.checkbox-inline {
label.checkbox-inline,
.switch label {
line-height: $line-height; // keep the same line height for radios and checkboxes
}

View File

@ -1,7 +1,12 @@
// This file is here to emulate the less #contrast function
@function calc-top($line-height, $font-size, $component-height) {
@return (($line-height * $font-size) - $component-height) / 2; // vertical center of line-height
}
// Emulate the less #contrast function
// TODO: this may be useful for the inverse theme, but if not, remove (it is unused after the removal of fullpalette)
// contrast-color and brightness borrowed from compass
// Copyright (c) 2009-2014 Christopher M. Eppstein
// Complies with license: https://github.com/Compass/compass/blob/stable/LICENSE.markdown