简体   繁体   中英

Thymeleaf th style

I'm trying Thymeleaf (Spring Boot 4 and Thymeleaf 2.x) at my application but had a parsing error for this:

th:style="'background-image: url('+@̣{css/nema/neder-e.png}+');'"

Which point I miss?

You have some weird characters between @ and { in your expression. I don't know what they are (CCA3 in hex?), but the expression itself is valid once they are removed.

尝试这个

th:style="'background-image:url(' + @{'/css/nema/neder-e.png' + ');'"

It's been a long time, but here's the solution for those who have this problem in the future :

th:style="'background-image: url(your-image-path);'"

You don't need do add something, juste replace your-image-path .

Exemple :

th:style="'background-image: url(/images/image.jpg);'"

images is located at resoureces/static directory of Spring boot

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM