Why does the text in thead and tfoot tags appear on the same line above the table? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 21

Why does the text in thead and tfoot tags appear on the same line above the table?

I was working on my code that has a table in it. When I finished it I decided to use some more tags and added the caption. Then I remembered about thead and tfoot tags and used them as well. I wrote some text insider. All the text from both tags appeared above my table on the same line. After that I added tr, th and td tags in between thead and tfoot tags. That fixed the problem in my code but I'm still wondering why it happened.

6th Feb 2020, 9:03 PM
Alex
Alex - avatar
2 ответов
+ 30
Well, that's because thead and tfood are NOT suppose to have data in them. Just use regular td tags for that purpose. Those tags are used as containers to group and organize table content. Semantically, they help search engines to identify content. Also browsers can use these elements to enable independent scrolling of the table body. So consider using tbody as well. When printing a large table that spans multiple pages, these elements can enable the table header and footer to be printed at the top and bottom of each page. So that way it doesn't look ambiguous.
6th Feb 2020, 9:18 PM
🇺🇦 Vitya 🇺🇦
🇺🇦 Vitya 🇺🇦 - avatar
+ 3
I have hommwork about Html can help me
14th Feb 2020, 6:19 PM
Hajoor Hajer305
Hajoor Hajer305 - avatar