You could achieve that if you use th:style to set your style attribute:
<div th:style="'background:url(' + @{/<path-to-image>} + ');'"></div>
Check this thread on thymeleaf forum.
Answer from Leandro Carracedo on Stack OverflowSetting CSS style attributes with thymeleaf - Stack Overflow
html - Style <th> with classes in CSS - Stack Overflow
Style table row with TH + TD - HTML & CSS - SitePoint Forums | Web Development & Design Community
Is there a functional difference between <th> and <td>?
Videos
You could achieve that if you use th:style to set your style attribute:
<div th:style="'background:url(' + @{/<path-to-image>} + ');'"></div>
Check this thread on thymeleaf forum.
The answer suggested by @Leandro Carracedo did not work for me (but it helped along the way), I had to add second pair of brackets and '$' to get the value out of the variable
<td th:style="'font-size:'+@{${headerTemplateTextSize}}+'; -webkit-margin-before: 0.67em; -webkit-margin-after: 0.67em; -webkit-margin-start: 0px;-webkit-margin-end: 0px; font-weight: 300; max-width: 100px'">
<div>...</div>
</td>
This is pretty basic, just use your th tag with the class selector immediately following.. So it would look something like...
th.product-remove,
th.product-thumbnail,
th.product-name,
th.product-price,
th.product-quantity,
th.product-subtotal {
border-bottom:1px solid #000;
}
th
{
/* add your styling here */
}
or, to limit to a specific class:
th.class-name
{
/* add your styling here */
}
Title.
I'm just coding for fun so I don't really care for accessibility.
Solved it while posting the question,
th:style="${condition ? 'display:block' : 'display:none'}" >
would produce the necessary conditional style. If condition is true display is set to block and none if condition is false.
For admin,
th:style="${role == 'ADMIN' ? 'display:block' : 'display:none'}" >
the style is set to display:block and for other roles the block is not displayed.
In simple case it could be written as
<div th:style="${filed==null ? 'opacity:.3'}">