Thymeleaf add value in style

Viewed 56

I have a div block that has styles. I need to add another style with a substitution value. I imagined it like this:

th:styleappend="background-position:-${value}%"

But it doesn't work. Is there a possibility to do this?

1 Answers

Most probably you are having a syntax issue here. Try the following code:

th:styleappend="'background-position:-' + @{${value}} + '%'"
Related