Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 未在spring启动应用程序中加载CSS_Java_Html_Css_Spring Mvc_Spring Boot - Fatal编程技术网

Java 未在spring启动应用程序中加载CSS

Java 未在spring启动应用程序中加载CSS,java,html,css,spring-mvc,spring-boot,Java,Html,Css,Spring Mvc,Spring Boot,我搜索了一整天,把style.css移到了任何地方,但仍然没有加载。图像也不会加载 我的结构: 但如果我单击firefox按钮,它会加载: 这是在索引头中导入style.css的方式: (尝试了各种组合) 当我检查开发人员工具时,它说404 for GET request(style.css和图片)Spring Boot知道静态目录在哪里,因此您不需要使用../技术来访问其中的文件。另一部分是,您应该使用注释来达到目的。这可能取决于您正在使用的视图模板,但对于thymeleaf,这是如何

我搜索了一整天,把style.css移到了任何地方,但仍然没有加载。图像也不会加载

我的结构:

但如果我单击firefox按钮,它会加载:

这是在索引头中导入style.css的方式:

(尝试了各种组合)


当我检查开发人员工具时,它说404 for GET request(style.css和图片)

Spring Boot知道静态目录在哪里,因此您不需要使用../技术来访问其中的文件。另一部分是,您应该使用注释来达到目的。这可能取决于您正在使用的视图模板,但对于thymeleaf,这是如何实现拉入css文件的:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Your Title</title>
    <link rel="stylesheet" th:href="@{/css/style.css}" />
</head>

你在用百里香吗?我想说一声非常感谢,因为我花了几个小时在这上面。我不熟悉thymeleaf语法,你写的很有意义。再次感谢!
<img th:src="@{/img/stanev2.png}" />