The Standard Dialect
Thymeleaf uses something called a "dialect." The Standard Dialect gives you a set of attributes that start with th:. These attributes tell Thymeleaf what to do with your HTML elements.
The th: Prefix
Every Thymeleaf attribute starts with th:. This prefix is what makes Thymeleaf attributes different from regular HTML attributes. Here are some common ones:
<div th:text="${username}">Guest</div>
<p th:if="${isLoggedIn}">Welcome back!</p>
<li th:each="item : ${items}" th:text="${item}"></li>
See the pattern? th:text replaces text content. th:if conditionally shows an element. th:each loops over a collection. Simple, right?
How Processing Works
When Thymeleaf processes your template, it reads each HTML element and checks if it has any th: attributes. If it does, Thymeleaf applies the attribute's logic. If not, the element stays exactly as written.
<h1 th:text="${title}">Page Title</h1>
<p>This paragraph has no th: attribute, so it stays unchanged.</p>
<p th:text="${description}">Description goes here</p>
The second <p> tag stays exactly as written because it has no th: attribute. The other two get processed and replaced.
More Common Attributes
Here are a few more th: attributes you'll use all the time:
<a th:href="@{/page}">Link</a>
<form th:action="@{/submit}" method="post">...</form>
<input th:value="${name}" />
<span th:style="'color:' + ${color}">Colored text</span>
Once you learn the pattern, you can guess what most th: attributes do. They usually mirror the HTML attribute they replace.