SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: TH and TD

  1. #1
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile TH and TD

    Whats the difference between TH and TD
    thanks

  2. #2
    SitePoint Evangelist Ed Seedhouse's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, B.C. Canada
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by simplecode
    Whats the difference between TH and TD
    thanks
    Semantically they are meant to convey different meanings.

    TH says "this cell's content is meant to tell you about a row or column"

    TD says "this cell's content is meant to convey the actual information in the table".

    Most browsers render text in a TH centered and bold by default.

    Otherwise, if I recall rightly, they may be used interchangeably, BUT they have different semantic meanings so that should be avoided.
    Ed Seedhouse

  3. #3
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how both works
    drawback or advantags of both....
    few example with explaination will be appriciated
    thanks

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    TH is a table header cell. It contains the header for a column, column group, row or row group.

    TD is a table data cell. It contains a piece of tabular data.
    Birnam wood is come to Dunsinane

  5. #5
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    few example with explaination will be appriciated

  6. #6
    Guru Meditation Error gnarly's Avatar
    Join Date
    Dec 2003
    Location
    Cheltenham, United Kingdom
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take this example:
    Code:
    <table>
         <thead>
               <tr>
                    <th scope="col">Some Foos</th>
                    <th scope="col">Some Bars</th>
               </tr>
         </thead>
         <tbody>
               <tr>
                    <td>Foo</td>
                    <td>Bar</td>
               </tr>
               <tr>
                    <td>Foo2</td>
                    <td>Bar2</td>
               </tr>
         </tbody>
    </table>
    The <th> (short for table heading) elements in the <thead> portion of the table, are the headings that sit at the top of each column. The scope attribute (can be row or col) tells you that they refer to the column of data below them. Think of them like an <h1> for the table column.

    The <td> (short for table data) elements in the <td> portion of the table contain the data that the <th> refers to.

    See also: http://www.w3schools.com/html/html_tables.asp
    Olly Hodgson
    thinkdrastic.net

  7. #7
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML Code:
    <table summary="Vote results: 30% yes, 70% no">
      <caption>Results of the vote</caption>
      <thead>
        <tr>
          <th id="h-sex">Sex</th>
          <th id="h-yes">Yes</th>
          <th id="h-no">No</th>
        </tr>
      </thead>
      <tfoot>
        <tr>
          <th id="h-total">Total</th>
          <td headers="h-total h-yes">30%</td>
          <td headers="h-total h-no">70%</td>
        </tr>
      </tfoot>
      <tbody>
        <tr>
          <th headers="h-sex" id="h-m">Men</th>
          <td headers="h-m h-yes">36%</td>
          <td headers="h-m h-no">64%</td>
        </tr>
        <tr>
          <th headers="h-sex" id="h-w">Women</th>
          <td headers="h-w h-yes">28%</td>
          <td headers="h-w h-no">72%</td>
        </tr>
      <tbody>
    </table>
    Code:
    Results of the vote
     Sex  Yes  No
     Men  36% 64%
    Women 28% 72%
    Total 30% 70%
    Birnam wood is come to Dunsinane

  8. #8
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks 2 All


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •