Twitter bootstrap Twitter引导程序是否将徽章设置为无填充(或轮廓)?

Twitter bootstrap Twitter引导程序是否将徽章设置为无填充(或轮廓)?,twitter-bootstrap,sass,less,badge,outline,Twitter Bootstrap,Sass,Less,Badge,Outline,有人知道如何将twitter引导徽章(或标签)从实体更改为轮廓吗 将此CSS类添加到您的徽章: .badge-outline { color: black; border: 1px solid #999; background-color: transparent; } 为其他颜色创建替代类: .badge-outline.badge-success { border-color: #468847; } 徽章的典型boostrap配置有以下与您的问题相关的关键

有人知道如何将twitter引导徽章(或标签)从实体更改为轮廓吗


将此CSS类添加到您的徽章:

.badge-outline {
    color: black;
    border: 1px solid #999;
    background-color: transparent;
}
为其他颜色创建替代类:

.badge-outline.badge-success {
    border-color: #468847;
}

徽章的典型boostrap配置有以下与您的问题相关的关键部分(在其
标签徽章中展开。较少
):

当前引导

.badge {
    color: @white;
    background-color: @grayLight;
    /* no border is set, just a border-radius: 9x */
}

.badge {
  // Important (red)
  &-important { background-color: @errorText; }
  &-important[href] { background-color: darken(@errorText, 10%); }

  // Warnings (orange)
  &-warning { background-color: @orange; }
  &-warning[href] { background-color: darken(@orange, 10%); }

  // Success (green)
  &-success { background-color: @successText; }
  &-success[href] { background-color: darken(@successText, 10%); }

  // Info (turquoise)
  &-info { background-color: @infoText; }
  &-info[href] { background-color: darken(@infoText, 10%); }

  // Inverse (black)
  &-inverse { background-color: @grayDark; }
  &-inverse[href] { background-color: darken(@grayDark, 10%); }
}
因此,您可以通过如下方式覆盖它:

在以后的LESS代码中重写

.badge {
    color: @black;
    background-color: transparent;
    border: 1px solid @grayLight; /* set your border */
}

.badge {
  // Important (red)
  &-important { background-color: transparent;
                border-color: @errorText;
                color: #errorText; /* maybe change color? up to you. */
              }
  &-important[href] { background-color: transparent;
                      border-color: darken(@errorText, 10%); 
                      color: darken(@errorText, 10%); /* ??? */
              }

  etc... for -warning, -success, -info, -inverse
}

快速引导4 sass版本

@each $color, $value in $theme-colors {
  .badge-outline-#{$color} {
    border: $border-width solid $value;
    color: $value !important;
    background: transparent !important;
  }
}