没有通过百里香叶显示css内容

问题描述 投票:1回答:1

我有css文件:main.css

h1 { 
    color: red;
}

的index.html

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Drink Shop</title>
<link rel="stylesheet" type="text/css" th:href="@{/css/main.css}"/>
</head>
<body>
    <h1>Wellcome</h1>
</body>
</html>

一切看起来都不错,但是h1文字的红色:wellcome并没有出现我使用百里香,弹簧靴。也许我应该在pom.xml中添加一些依赖?

等级制度

enter image description here

java html css thymeleaf
1个回答
2
投票

试试这个,

<link rel="stylesheet" href="../css/main.css" th:href="@{/css/main.css}" type="text/css"/>
© www.soinside.com 2019 - 2024. All rights reserved.