954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

<tbody> tag

What exactly is the point of the tag? Can one table consist of more than one pair of these tags?

cscgal
The Queen of DaniWeb
Administrator
19,437 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 231
 

I think:
is all the column headings, i.e. the first row of most tables
is the data under those headings

so technically if you need two tbodies then you must have changed column headings, which technically is another table.

Or wasn't that what you had in mind?

DaveSW
Master Poster
769 posts since Jul 2004
Reputation Points: 54
Solved Threads: 20
 

My question is whether it is legal to do:

<table>
  <thead>
	<tr><td>Heading</td></tr>
  </thead>
  <tbody>
	<tr><td>Body 1</td></tr>
  </tbody>
  <tbody>
	<tr><td>Body 2</td></tr>
  </tbody>
</table>
cscgal
The Queen of DaniWeb
Administrator
19,437 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 231
 

it validates in xhtml 1.0 strict.

Also http://www.htmlhelp.com/reference/html40/tables/tbody.html
It refers to needing 'one or more' tbody elements in a table.

So I guess you can.

edit: see also http://www.w3.org/TR/html4/struct/tables.html#h-11.2.3 - which also refers to one or more

DaveSW
Master Poster
769 posts since Jul 2004
Reputation Points: 54
Solved Threads: 20
 

Oh cool! Thanks. Definitely answers my question.

cscgal
The Queen of DaniWeb
Administrator
19,437 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 231
 

lol no problem ;)

DaveSW
Master Poster
769 posts since Jul 2004
Reputation Points: 54
Solved Threads: 20
 

Has this replaced ? If not when do you use one over the other?
Thanks,
BuddyB

buddyb
Junior Poster
185 posts since Oct 2003
Reputation Points: 10
Solved Threads: 2
 

tbody is for grouping td tags.

The TBODY element defines a group of data rows in a table.

so in a data table, your column headings would be in a thead tag, the main body of the td cells in a tbody, and the footer info in a tfoot tag. Or something like that anyway.

DaveSW
Master Poster
769 posts since Jul 2004
Reputation Points: 54
Solved Threads: 20
 

I got it, thanks.
BB

buddyb
Junior Poster
185 posts since Oct 2003
Reputation Points: 10
Solved Threads: 2
 

no problem ;)

DaveSW
Master Poster
769 posts since Jul 2004
Reputation Points: 54
Solved Threads: 20
 

hi,,,,,
cn u plz suggest me sumthing 4 ma web project??
My web project topic is Cartoons..
so wat exactly i should do??
plzz rly,,if u hv any idea regarding wid dis..

onlyvidya
Newbie Poster
13 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

This is not quite right.

The purpose of tbody is to go with thead and tfoot to make a table that has a header and footer that are always visible when the table is larger than a page.

If you use tbody, you also need to use thead and tfoot, and they must be placed in the following order:

<table>
  <thead>
    <tr>
      <th>stuff 1</th><th>stuff 2</th>
    </tr>
  </thead>
  <tfoot>
    <tr>
      <th>stuff 1</th><th>stuff 2</th>
    </tr>
  </tfoot>
  <tbody>
    <tr>
      <td>stuff 1</td><td>stuff 2</td>
    </tr>
  </tbody>
</table>
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You