Thymeleaf + CSS+SpringBoot

Move your template folder right under resources:

  • src/main/resource/static/css (for CSS files);
  • src/main/resource/templates (for HTML templates).

Then correct the link tag as follows:

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

Move your template folder right under resources:

src/main/resources/static/css (for CSS files);
src/main/resources/templates (for HTML templates).

Then correct the link tag as follows (relative or absolute):

<link href="../css/firstcss.css" rel="stylesheet">
<link href="/css/secondcss.css" rel="stylesheet">

The old solution with static in front doesn't work for me.