th:background usage

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

th:background usage

lfournial
Hi,

I'am new in Thymeleaf.
I'am doing the migration of an old apps with tiles in an apps with Thymeleaf.

I have a problem with the transformation of the thing :

style="background: url(../../style/images/bg_shadow_left.png) repeat-y right; width: 6px;"


In static mode , no problem with that.

But at runtime, I try something like that :

th:with="6" th:attr="background-image=@{/images/bg_shadow_left.png},background-repeat=repeat-y,background-position=right"

 but it don't work : Could not parse as assignation sequence.

Can you give me the light concerning the usage of this type of tags please, i search in the documentation but don't find samples.

Thanks

--
Loïc
Reply | Threaded
Open this post in threaded view
|

Re: th:background usage

Zemi
Administrator
The direct translation to

   style="background: url(../../style/images/bg_shadow_left.png) repeat-y right; width: 6px;"

would be

   th:style="'background: url(' + @̣{/images/bg_shadow_left.png} + ') repeat-y right; width: 6px;'"

provided your image is in the images folder (relative to template prefix).

Reply | Threaded
Open this post in threaded view
|

Re: th:background usage

lfournial
Hey nice,

Thanks so much Zemi, i don't have seen the th:style tag .