skip to Main Content

I am currently running a simple spring boot project via vscode. Everything works well but my css and javascript assets won’t load when i run it.

this is my current project structure
enter image description here

and this is how I add the css for instance to the project:

<link rel="stylesheet" th:href="@{/css/mycss.css}"

2

Answers


  1. Chosen as BEST ANSWER

    this worked for me

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

  2. To use relative path in html you should use:

    <link rel="stylesheet" th:href="@{.assets/css/mycss.css}"

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search