0

I have used spring boot with Thymeleaf (thymeleaf starter dependency is added).

The css files are places under src/main/resources/static and the html files are placed under src/main/resources/templates

The spring main class is annotated with @SpringBootApplication(As usual).

Say in First controller for /ui , I am returning index.html. It loads the CSS.

Say in a method for Url "ui/video/viewAll", I am returning abc.html (with content- fragment concept - using the same layout of index.html. Seems css files are loaded for this html alone.

Not sure why this behaviour? Can anybody explain why is this happening?

Raduan Santos
  • 1,023
  • 1
  • 21
  • 45
  • 1
    Could you post (relevant parts of) index.html and abc.html? Hard to figure out what's wrong with the code if we don't see the code I'm guessing the css files aren't loaded through the layout fragment, and thus not included in abc.html – jvdmr Feb 05 '19 at 15:19
  • 2
    It's probably because you're using relative urls for your css. – Metroids Feb 05 '19 at 15:36
  • @Metroids should probably be right about this one. You should be using using relative urls for CSS and if your layout fragment usage is correct than relative urls must be the case – Ahmet Feb 06 '19 at 12:19

0 Answers0