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 Overflow
๐ŸŒ
DotFactory
dofactory.com โ€บ html โ€บ th โ€บ style
HTML th style
In HTML, the style attribute on a th element assigns a unique style to that element.
๐ŸŒ
W3Schools
w3schools.com โ€บ tags โ€บ tag_th.asp
HTML th tag
The <th> tag also supports the Event Attributes in HTML. ... <table style="width:100%"> <tr> <th style="text-align:left">Month</th> <th style="text-align:left">Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table> Try it Yourself ยป
Discussions

Setting CSS style attributes with thymeleaf - Stack Overflow
How to set the background property of a style tag with a thymeleaf resolved url. More on stackoverflow.com
๐ŸŒ stackoverflow.com
html - Style <th> with classes in CSS - Stack Overflow
I have some trouble with HTML tables. My table looks like the following: More on stackoverflow.com
๐ŸŒ stackoverflow.com
Style table row with TH + TD - HTML & CSS - SitePoint Forums | Web Development & Design Community
Is there an easy way to style a table row which has both a TH and TDโ€™s? Rain Coat Child's Yellow $39.99 If I add a class to TR then it just styles the TDโ€™s. And itโ€™s a pain to have to add a class to TR and the TH. โ˜น More on sitepoint.com
๐ŸŒ sitepoint.com
0
January 5, 2021
Is there a functional difference between <th> and <td>?
- table heading - used to provide headings for columns and rows. - table data - used to hold the data values of individual cells. The two elements get slightly different default visual styles, usually making text content bold in . It really doesn't matter if you care about accessibility - your potential site visitors frequently do care. Might as well do things properly from day one, IMO. More on reddit.com
๐ŸŒ r/HTML
5
2
July 21, 2024
๐ŸŒ
Codecademy
codecademy.com โ€บ forum_questions โ€บ 53a473a552f863a0f3000b31
Style attribute to <tr> and <th> tags? | Codecademy
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>TABLE, TR or TH/TD</title> <style> table { width: 100%; } tr { background-color: #def; } th { background-color: #cba; } td { width: 30%; height: 30px; color: red; background: transparent; } </style> </head> <body> <!-- very basic table for illustration only --> <table> <tr> <th>Lorem</th> <th>Ipsum</th> <th>Dolor</th> </tr> <tr> <td>Lorem column text</td> <td>Ipsum column text</td> <td>Dolor column text</td> </tr> <tr> <td>Lorem column text</td> <td>Ipsum column text</td> <td>Dolor column text</td> </tr> </table> </body> </html>
๐ŸŒ
o7planning
o7planning.org โ€บ 12373 โ€บ thymeleaf-th-class-th-classappend-th-style-th-styleappend
Thymeleaf th:class, th:classappend, th:style, th:styleappend | o7planning.org
th:style will create a the style attribute (or replace the available style attribute) during generating HTML by the Thymeleaf Engine.
๐ŸŒ
HTML Tables
htmltables.io โ€บ tags โ€บ th
HTML <th> Tag โ€” Web Reference (2024)
May 28, 2024 - This CSS snippet styles <th> elements with a light gray background, bold text, a border, and adequate padding for better visual appeal.
Find elsewhere
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ HTML โ€บ Element โ€บ th
<th>: The Table Header element - HTML - MDN Web Docs
<table> <tr> <th scope="col">Symbol</th> <th scope="col">Code word</th> <th scope="col">Pronunciation</th> </tr> <tr> <th scope="row">A</th> <td>Alfa</td> <td>AL fah</td> </tr> <tr> <th scope="row">B</th> <td>Bravo</td> <td>BRAH voh</td> </tr> <tr> <th scope="row">C</th> <td>Charlie</td> <td>CHAR lee</td> </tr> <tr> <th scope="row">D</th> <td>Delta</td> <td>DELL tah</td> </tr> </table> Some basic CSS is used to style the table and its cells.
๐ŸŒ
W3docs
w3docs.com โ€บ learn-html โ€บ html-th-tag.html
HTML th Tag - Learn HTML | W3Docs
If you want to display the first row of the table as labels or headings, for the content in the tableโ€™s first row you must use <th> elements instead of <td> elements. By default, the content of the <th> tag is bold and centered. To change its look, you can use CSS styles.
๐ŸŒ
Quora
quora.com โ€บ What-does-th-mean-in-style-tag-in-html
What does th mean in style tag in html? - Quora
Answer (1 of 19): style used for making websites with applicable styles. In HTML every element(line) has attributes like font type,color, width,height,margin, border..etc. To define values for this attributes HTML uses the style tag. There are three ways to define style in HTML. 1).In the same li...
๐ŸŒ
Thymeleaf
thymeleaf.org โ€บ doc โ€บ tutorials โ€บ 2.1 โ€บ usingthymeleaf.html
Tutorial: Using Thymeleaf
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"> <head> <title>Good Thymes Virtual Grocery</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" media="all" href="../../css/gtvg.css" th:href="@{/css/gtvg.css}" /> </head> <body> <p th:text="#{home.welcome}">Welcome to our grocery store!</p> </body> </html>
๐ŸŒ
Lenovo
lenovo.com โ€บ home
The Role of HTML `<th>` Tag in Tables | Lenovo US
Set the white-space property to normal or wrap for the <th> tag or its container. This allows the text to wrap within the cell instead of overflowing. For example, you can use th { white-space: normal; } in your CSS stylesheet to enable text wrapping within <th> tags.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ html โ€บ html-th-width-attribute
HTML &lt;th&gt; width Attribute - GeeksforGeeks
September 16, 2024 - The HTML <th> width Attribute is used to specify the width of a table header cell.
๐ŸŒ
SitePoint
sitepoint.com โ€บ html & css
Style table row with TH + TD - HTML & CSS - SitePoint Forums | Web Development & Design Community
January 5, 2021 - Is there an easy way to style a table row which has both a TH and TDโ€™s? <tr> <th>Rain Coat</th> <td>Child's</td> <td>Yellow</td> <td>$39.99</td> </tr> If I add a class to TR then it just styles the TDโ€™s. And itโ€™s aโ€ฆ
๐ŸŒ
W3C
w3.org โ€บ MarkUp โ€บ html3 โ€บ tablecells.html
Table Cells (TH and TD)
This distinction gives user agents a means to render such cells distinctly, for instance by using a larger or heavier font for header cells. It is also needed when rendering to speech. The CLASS attribute can be used to further differentiate cells, for instance into heads and subheads. This can be used together with style sheets to control the cell border style, and fill color etc.
๐ŸŒ
TechOnTheNet
techonthenet.com โ€บ html โ€บ elements โ€บ th_tag.php
HTML: <th> tag
The HTML <th> tag defines a header cell that can appear in the first row of an HTML table. Browsers traditionally render the text found within the <th> tag as bold, center-aligned text.
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ html โ€บ html_th_tag.htm
HTML - <th> Tag
Let's look at the following example, where we are going to consider the basic usage of the <th> tag. <!DOCTYPE html> <html> <style> table, th, td { border: 2px solid #D2B4DE; } </style> <body> <table> <tr> <th>Name</th> <th>Age</th> </tr> <tr> <td>Maya</td> <td>23</td> </tr> <tr> <td>Ravi</td> <td>22</td> </tr> <tr> <td>Ram</td> <td>21</td> </tr> </table> </body> </html> Consider the following example, where we are going to use the colspan attribute along with the <th> tag.
๐ŸŒ
Instagram
instagram.com โ€บ th.style
Instagram
We cannot provide a description for this page right now