Bootstrap开源组件:徽章的文档和示例。使用世界上最流行的前端开源工具包 Bootstrap 快速设计和定制响应式移动优先网站,具有 Sass 变量和混合、响应式网格系统、广泛的预构建组件和强大的 JavaScript 插件。
但是它的很多组件都是继承在整体JavaScript中,今天分离的徽章的文档和示例,先看样式:
完整代码如下:
<div class="shbd-example">
<button type="button" class="shbtn shbtn-primary">
Profile <span class="shbadge shbadge-light">9</span>
</button>
</div>
<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>
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有