Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Spring Boot Thymeleaf not recognizing CSS file

The problem is that a thymeleaf does not find my css file

Project structure
enter image description here

I am able to access css file with given url http://localhost:8080/styles.css

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I use spring boot 3.1.1

I have tried

and

as well as

Template does show correctly but css is not applied

>Solution :

This is the correct syntax in your case:

<link th:href="@{/styles.css}" rel="stylesheet" />
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading