1

I'm writing a web-site in Java. HTML file:

<body th:style="'background-image:url(' + @{/templates/fon.jpg} + '); background-repeat: no-repeat, repeat; background-size: cover;'">
</body>

When I run is there is still no background. No css code please.

I did not try anything yet.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Axion
  • 11
  • 2
  • Hi & Welcome! My guess: `@{/templates/fon.jpg}` is no valid "servlet path"(404!?...Check in browser console) – xerx593 Dec 03 '22 at 09:07
  • 1
    Proposal: place `fon.jpg` (file) in `src/main/resources/static/some/folder` , and the link pointing to *`@{/some/folder/fon.jpg}`* (clean, build, test;) so the most important portion: *`src/main/resources/static/...`* ..see: https://github.com/spring-projects/spring-petclinic/tree/main/src/main/resources/static – xerx593 Dec 03 '22 at 09:13

0 Answers0