2

To create table in HTML we use <table>, <tr>, <th>, and <td>.

But nowadays I see often <thead>, <tfoot>, and <tbody>` used. Is this a new method of HTML? Why is this needed too? What are the benefits of doing it like this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
luxi
  • 317
  • 1
  • 4
  • 17
  • A simple google search will answer your question – TheEwook Apr 12 '13 at 08:38
  • I have http://www.w3schools.com/tags/tag_tbody.asp this but din't understand properly. I mean why to use this instead? – luxi Apr 12 '13 at 08:39
  • I suggest you to always refer to [W3C](http://www.w3.org/html/) rearding HTML specification. Many would strongly desagree in consulting [w3schools](http://w3fools.com/). In general, before posting, have a look to the [tag info](http://stackoverflow.com/tags/html/info). – Alberto De Caro Apr 12 '13 at 08:49
  • w3schools has nice tutorial and why disagree consulting this. – luxi Apr 12 '13 at 09:02

4 Answers4

1

Refer to HTML <thead> Tag. It gives the browser more information about the table, allowing it to make smarter choices when displaying the table.

For example: When scrolling in a big table, the header might be locked to the top of the screen, so you do not need to scroll up to find out what a column meant.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Guran
  • 34
  • 2
1

Theey are just new tags used to specify each part of a table (body, header, and footer). Before it was possible only with the <th> tag (header).

It might be easier to style these elements with CSS too.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
TheEwook
  • 11,037
  • 6
  • 36
  • 55
1

First you should know that HTML has already been upgraded to HTML5. So previously HTML tags didn't have the tags such as you mentioned so <thead> is for the table header, <tfoot> for the footer and <tbody> is the same as body when you are starting a HTML page.

For more information, better go to HTML5 Demos and Examples.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
sentil kumar
  • 97
  • 2
  • 7
1

It is just an advanced way of writing HTML table tags (body, head, and footer).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131