补充 label 样式

This commit is contained in:
2betop 2020-07-04 22:56:58 +08:00
parent fb9298287a
commit 2e04242370
3 changed files with 84 additions and 0 deletions

View File

@ -392,3 +392,14 @@
$gap-sm; $gap-sm;
color: $text--muted-color; color: $text--muted-color;
} }
@mixin label-variant($color) {
background-color: $color;
&[href] {
&:hover,
&:focus {
background-color: darken($color, 10%);
}
}
}

View File

@ -1517,6 +1517,69 @@
word-wrap: break-word; word-wrap: break-word;
} }
//
// Labels
// --------------------------------------------------
.label {
display: inline;
padding: 0.2em 0.6em 0.3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: $label-color;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 0.25em;
// Empty labels collapse automatically (not available in IE8)
&:empty {
display: none;
}
// Quick fix for labels in buttons
.btn & {
position: relative;
top: -1px;
}
}
a.label {
&:hover,
&:focus {
color: $label-link--hover-color;
text-decoration: none;
cursor: pointer;
}
}
// Colors
// Contextual variations (linked labels get darker on :hover)
.label-default {
@include label-variant($label--default-bg);
}
.label-primary {
@include label-variant($label--primary-bg);
}
.label-success {
@include label-variant($label--success-bg);
}
.label-info {
@include label-variant($label--info-bg);
}
.label-warning {
@include label-variant($label--warning-bg);
}
.label-danger {
@include label-variant($label--danger-bg);
}
@keyframes apearSensor { @keyframes apearSensor {
from { from {
opacity: 0; opacity: 0;

View File

@ -138,6 +138,16 @@ $gap-lg: px2rem(30px) !default;
$icon-color: $gray600 !default; $icon-color: $gray600 !default;
$icon-onHover-color: $gray900 !default; $icon-onHover-color: $gray900 !default;
$label--default-bg: $gray700 !default;
$label--primary-bg: $primary !default;
$label--success-bg: $success !default;
$label--info-bg: $info !default;
$label--warning-bg: $warning !default;
$label--danger-bg: $danger !default;
$label-color: #fff !default;
$label-link--hover-color: #fff !default;
// Components // Components
$scrollbar-width: px2rem(17px) !default; $scrollbar-width: px2rem(17px) !default;