Forum Moderators: open

Message Too Old, No Replies

TBody

What's the point?

         

chris_f

8:58 am on May 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi All,

I see the TBody tag all the time when following on from someone elses work. The first thing I do is remove it. I have read several articles on it but the question still remains. What is the point of this tag? What does it do?

Chris

PsychoTekk

10:03 am on May 25, 2003 (gmt 0)

10+ Year Member



hi chris, hope this helps:
[w3.org...]
internally msie, mozilla,... convert ANY <table>
struct to a <table> ... <tbody> etc. struct.

ShawnR

10:16 am on May 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can have a number of tbody's in a table to have a number of groups of rows. Each tbody can have its own css class and hence have different presentation styles.

Also, you can use thead and tfoot (once each in a table), with multiple tbody tags between them. Maybe someday a browser will be implemented that keeps the head and foot of a table in place and has the body rows scroll... I think some browsers might do that for printing already... that is the intent anyhow, even though it is not widely supported AFAIK.

e.g.

<table>
__<thead>
____<tr>...</tr>
____<tr>...</tr>
__</thead>
__<tbody class="xxx">
____<tr>...</tr>
____<tr>...</tr>
__</tbody>
__<tbody class="yyy">
____<tr>...</tr>
____<tr>...</tr>
__</tbody>
__<tfoot>
____<tr>...</tr>
____<tr>...</tr>
__</tfoot>

Shawn

[add: Oops, I should have refreshed my browser... W3 explains it better]

[edited by: ShawnR at 10:19 am (utc) on May 25, 2003]

chris_f

10:18 am on May 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks PT,

That make the question of what it does clearer. However, why would you do it. I'd rather just code header ... content ... footer. If it was involved with paging I'd understand it's use but I just can't see why you would use it. Especially because, the code that I edit seems only to even have TBody and not THead or TFoot.

Chris

Sinner_G

11:56 am on May 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Only tbody doesn't make much sense. The only reason I can see to use those tags (including thead and tfoot) is the print thing, i.e. having the header and footer of a long table printed on each page.

chris_f

12:01 pm on May 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right,

I'm with you now. I understand.

Thanks
Chris

victor

1:41 pm on May 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think Shawnr has identified one of the few practical uses for tbody.

If you have more than one tbody, you can apply a CSS class to each -- thus allowing differing styles for contiguous rows without having to specify class on each row. That may reduce code bloat.

An example might be a table whose first five rows are highlighted as special offers, next n are normal sales and last few are special bargains. With three tbodys you can apply the special stylings just once not matter how many rows you have.