html - Thymeleaf - Chrome 看不到 css 文件

标签 html css thymeleaf

告诉我,为什么我的浏览器看不到我的 css 文件? 我使用 spring boot 和 thymeleaf :

<link rel="stylesheet" type="text/css" href="../static/css/style.css" th:href="@{/css/style.css}"/>

我的 css 文件在 resources/static/css 我的模板在资源/模板上

当我在 InteliJ 中单击“chrome”图标时,一切都在离线状态下正常工作,但是当我运行我的应用程序时,没有加载 css。

最佳答案

你不需要设置href="../static/css/style.css"

尝试:

<link rel="stylesheet" type="text/css" th:href="@{/css/style.css}"/>

关于html - Thymeleaf - Chrome 看不到 css 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47521412/

相关文章:

css - DIV 彼此相邻并防止换行(仅限 css)

javascript - 在php/javascript中单击另一个页面中的按钮时需要启用按钮

jquery - 使用 Thymeleaf 调用 Javascript 函数

java - springboot + thymeleaf 在html表格中显示数据库内容

html - openlayers html/css,一个div在另一个上

html - 位置:iPhone iOS 中的固定页脚

css - 扩展命名选择器的选择器的自动选择器?

html - 图像下方的空白

twitter-bootstrap - 如何在 thymeleaf 中执行数据目标 ="#userId"

javascript - 对输入框中现有值的 HTML5 验证