Couldn’t we use a `<tr>` tag rather than the `<tfoot>` tag for the footer instead?



Couldn’t we use a <tr> tag rather than the <tfoot> tag for the footer instead?


Yes we could use a <tr> tag and omit the <tfoot> tag altogether. While browsers might not complain, it’s important to realize that including the semantic <tfoot> tag improves the accessibility and the user experience of our page.

When our tables have footer information, it is best practice to nest that information within the semantic <tfoot> tag.

FAQ: Learn HTML Tables - Tables - Table Footer

sir,with <tr>or with out using it inside the <tfoot> the results are same. it only showing the data in rows why not in column’s??


We could but as I understand it we shouldn’t. As @wiki-bot has emphasised, the best-practice of nesting the info within the semantic tag where necessary.


spot on @mkiscoding!

We can find good articles why semantic markup:

is very important.

The tricky thing is when you just start learning HTML, semantic markup does not seem very important, which is why its important that experienced programmers empathize to new learners that semantic markup is very important.

Experienced programmers have the experience of building projects, from which they learned how important semantic markup is.


noted that with or without <tr> inside <tfoot> , result as same .
Is it compulsory to add <tr> inside ,<tfoot > ? TQ


yes, looking at the documentation:

we can see the permitted content: Zero or more <tr> elements.

sure, browser are very error resistance, but you should still follow the right way for a variety of reasons (for other developers working on your code, helping tools for people with poor vision, SEO and more)