Bootstrap开源组件:徽章的文档和示例

2022-04-12 12:08:57 浏览数 (1)

Bootstrap开源组件:徽章的文档和示例。使用世界上最流行的前端开源工具包 Bootstrap 快速设计和定制响应式移动优先网站,具有 Sass 变量和混合、响应式网格系统、广泛的预构建组件和强大的 JavaScript 插件。

但是它的很多组件都是继承在整体JavaScript中,今天分离的徽章的文档和示例,先看样式:

完整代码如下:

代码语言:html复制
<div class="shbd-example">
    <button type="button" class="shbtn shbtn-primary">
      Profile <span class="shbadge shbadge-light">9</span>
     
    </button>
    </div>
代码语言:css复制
<style>
    .shbtn {
    display: inline-block;
    font-weight: 400;
    color: #212529;
    text-align: center;
    vertical-align: middle;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.shbadge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.shbadge-light {
    color: #212529;
    background-color: #f8f9fa;
}
.shbtn .shbadge {
    position: relative;
    top: -1px;
}
.shbd-example>.shbtn, .shbd-example>.shbtn-group {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}
.shbd-example {
    padding: 1.5rem;
    margin-right: 0;
    margin-left: 0;
    border-width: 0.2rem;
}
.shbtn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}
</style>

0 人点赞