bootstrap-4 - 引导导航药丸不起作用
问题描述
我是 Bootstrap 的新手,我正在构建一个简单的应用程序来显示产品列表。但我注意到nav-pills
产品表格下方的导航没有 CSS 效果。
这是我用作模板的详细 HTML:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<meta charset="utf-8"/>
<title>Produits</title>
</head>
<body>
</br>
</br>
<div class="container">
<h3>Liste des Produits</h3>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Désignation</th>
<th>Prix</th>
<th>Quantité</th>
</tr>
</thead>
<tbody>
<tr th:each="p:${listProduits}">
<td th:text="${p.id}"></td>
<td th:text="${p.designation}"></td>
<td th:text="${p.prix}"></td>
<td th:text="${p.quantite}"></td>
</tr>
</tbody>
</table>
</div>
<div class="container">
<ul class="nav nav-pills">
<li role="presentation" th:each="page,status:${totalPages}">
<a href="#" th:text="${status.index}"> </a>
</li>
</ul>
</div>
</body>
</html>
请注意,我使用 Thymeleaf 作为模板引擎。
在此先感谢您的帮助。
解决方案
You only set the required classes on the ul
element, but according to the Nav Pills documentation, you need to add nav-item
class to the li
elements, and nav-link
class to the a
elements:
<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link" href="#">Active</a>
</li>
...
</ul>
推荐阅读
- c++ - 删除二叉树的节点
- menu - 如何阻止菜单在不同缩放级别上分成不同的行?
- c++ - 识别整数并用 X 替换数字
- python - python: logging:: 获取自定义时区的当前时间
- java - 如何让通知声音持续播放并仅在单击通知的“取消通知”按钮时停止
- javascript - 带有里程碑的引导进度条
- terminal - 纳米错误中的光标用于更长的行
- java - Spring Boot 审计 - 将当前用户映射到 @CreatedBy、@LastModifiedBy
- python - Pandas DataFrame 中的分组时间数据
- python - tf.gradients() 返回 [None] 的列表