将徽章组件添加到 Bootstrap 列表组项
将徽章组件添加到任何列表组项目,它会自动定位在右侧。只需在 <li> 元素中添加 <span class = "badge">。
您可以尝试运行以下代码来实现这一点
示例
<!DOCTYPE html><html>
<head>
<title>Bootstrap Example</title>
<link href = "/bootstrap/css/bootstrap.min.css" rel =" stylesheet">
<script src = "/scripts/jquery.min.js"></script>
<script src = "/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<h3>Tutorials</h3>
<ul class = "list-group">
<li class = "list-group-item">Programming</li>
<li class = "list-group-item">Web Development</li>
<li class = "list-group-item">Networking</li>
<li class = "list-group-item">
<span class = "badge">New</span>
Database
</li>
<li class = "list-group-item">SAP</li>
<li class = "list-group-item">
<span class = "badge">New</span>
Academic
</li>
</ul>
</body>
</html>
以上是 将徽章组件添加到 Bootstrap 列表组项 的全部内容, 来源链接: utcz.com/z/341481.html