Use Tbody -Thead

Hello. Why use tbody and thead in table?Why don’t
use all table element in same place?

Hello @Ekrem.Bulut,
<tbody> and <thead> is part of HTML5 that is actually very useful for the readability of code. It is called semantic tags. It means that the tag means exactly what it says. So <thead> means its the head of the table. There are a lot of semantic tags out there. Here are some of them:

<main>Main Content</main>
<section> Section</section>
<nav>Nav Bar</nav>
<!-- And Much More -->

It’s sole purpose is for readibility on the code with added functions. It is easier to read those above than doing these:

<div class="nav-bar">Nav</div>
<div class="footer"></div>

You can learn more about semantic tags here :


All right!

name age job
x 30 doctor
y 29 police




What is difference between them? Only readability? They seem same in website.

name age job

Well in a table, anything inside the <thead> will be put at the top of the table and is usually emphasized because it is the header. Inside of <thead> is also always <th> instead of <td> to turn it into header. Then <tbody> will be underneath the head.

So this will be
Hello thead
hello tbody
1 Like
If you click this, you can see :slight_smile: