【发布时间】:2020-01-31 20:40:12
【问题描述】:
我在使用 Bootstrap 4 时遇到问题:样式未加载到页面中。我正在使用 Spring Boot、Maven 和 THymeleaf。
在我的 HTML 文件中
<link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/4.0.0-beta.2/css/bootstrap.min.css}" />
我的 Maven 依赖项中也有
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>4.3.1</version>
</dependency>
例如,当我尝试添加引导卡或按钮时,我会以基本的 html 样式看到它们。 那么,我的问题是什么? 感谢帮助
【问题讨论】:
-
您是否在
<head><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"></head>标签上添加了引导CDN 链接?如果这个工作正常,那么确保你的 maven 依赖相对路径是正确的? -
是的,路径很好,链接在head标签中,但还是坏了
-
你是否在配置类中配置了 web-jars?
标签: spring maven spring-boot bootstrap-4 thymeleaf