Bootstrap4组件:徽章(Badge)与链接,面包屑导航(Breadcrumb)


发布时间:2020-03-18 20:47    作者: Uncle Hui   已过去:4 月,2 周   阅读总量:164 已被赞:0


徽章(Badge)

示例

.badge可以嵌在标题中,并通过标题样式来适配其元素大小,因为其本身是通过相对字体大小和em单位的,所以有良好的弹性。

<h1>夏季清爽运动鞋 <span class="badge badge-secondary">New</span></h1>

<h2>夏季清爽运动鞋 <span class="badge badge-secondary">New</span></h2>

<h3>夏季清爽运动鞋 <span class="badge badge-secondary">New</span></h3>

<h4>夏季清爽运动鞋 <span class="badge badge-secondary">New</span></h4>

<h5>夏季清爽运动鞋 <span class="badge badge-secondary">New</span></h5>

<h6>夏季清爽运动鞋 <span class="badge badge-secondary">New</span></h6>

 

徽章可用作链接或按钮的一部分,以提供统计数字样式。

<button type="button" class="btn btn-primary">

通知 <span class="badge badge-light">6</span>

</button>

<!-- <a href="#" class="btn btn-primary">

通知 <span class="badge badge-light">6</span>

</a> -->

情景变化

<span class="badge badge-primary">Primary</span>

<span class="badge badge-secondary">Secondary</span>

<span class="badge badge-success">Success</span>

<span class="badge badge-danger">Danger</span>

<span class="badge badge-warning">Warning</span>

<span class="badge badge-info">Info</span>

<span class="badge badge-light">Light</span>

<span class="badge badge-dark">Dark</span>

椭圆形胶囊标签

使用 .badge-pill样式,可以使标签更加圆润(具体有较大的border-radius边框半径和水平padding), 如果你错过了V3的标签这是有用的(这是Bootstrap 4中的特色功能)。

<span class="badge badge-pill badge-primary">Primary</span>

<span class="badge badge-pill badge-secondary">Secondary</span>

<span class="badge badge-pill badge-success">Success</span>

<span class="badge badge-pill badge-danger">Danger</span>

<span class="badge badge-pill badge-warning">Warning</span>

<span class="badge badge-pill badge-info">Info</span>

<span class="badge badge-pill badge-light">Light</span>

<span class="badge badge-pill badge-dark">Dark</span>

链接

.badge-* 也可以在 <a> 元素上使用,并实现悬停、焦点、状态等效果。

<a href="#" class="badge badge-primary">Primary</a>

<a href="#" class="badge badge-secondary">Secondary</a>

<a href="#" class="badge badge-success">Success</a>

<a href="#" class="badge badge-danger">Danger</a>

<a href="#" class="badge badge-warning">Warning</a>

<a href="#" class="badge badge-info">Info</a>

<a href="#" class="badge badge-light">Light</a>

<a href="#" class="badge badge-dark">Dark</a>

 

面包屑导航(Breadcrumb)

<nav>

<ol class="breadcrumb">

<li class="breadcrumb-item active">首页</li>

</ol>

</nav>

 

<nav>

<ol class="breadcrumb">

<li class="breadcrumb-item"><a href="#">首页</a></li>

<li class="breadcrumb-item active">女装</li>

</ol>

</nav>

 

<nav>

<ol class="breadcrumb">

<li class="breadcrumb-item"><a href="#">首页</a></li>

<li class="breadcrumb-item"><a href="#">女装</a></li>

<li class="breadcrumb-item active">连衣裙</li>

</ol>

</nav>

点赞

0




登陆后方可评论