Introduction to Fragments
index.html page currently contains some significant duplication. If you are not familiar with Tailwind CSS, you might try to tackle the many classes issue by creating custom CSS classes.
However, it is more helpful to think in terms of full components we can reuse. When we do this, we won’t need to define our own CSS classes to reduce the duplication.
Thymeleaf uses the concept of fragments, which are basically reusable snippets of HTML. They are very similar to methods. Just as we use methods to more effectively structure our Java code, we use fragments to structure our HTML pages better. We define a fragment using