Im structuring an email in the backend with Spring and Thymeleaf, and i have come across the following problem: I need to inject a color hex code as a CSS property while using inline CSS.
<span
th:text="${newStateText}"
style="display: inline-block; padding: 0.35em 0.65em; font-size: .75em; font-weight: 700; line-height: 1; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: 1rem;"
th:style="'background-color: '+${newStateBackgroundColor}+'; color: '+${newStateColor}+''"
>
</span>
As you can see, im trying to use something like th:style
which does not exist (i think) to inject the newStateBackgroundColor
and newStateColor
context variables
I expect to be able inject some style properties by variable and also keep my styles inline.
Ramiro Moya Isnaldi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.