View Full Version : What's the difference between <td> and <th> tag?
heavensgate15
06-16-2009, 12:41 PM
what's the big difference between <td> and <th>? When to use <td> effectively and when to use <th> effectively?
forum_amnesiac
06-16-2009, 01:07 PM
<th> defines a header cell, <td> a normal cell:
This code will give you an example:
<table border = "1">
<tr>
<th>Tag</th>
<th>Description</th>
</tr>
<tr>
<td>td</td>
<td>Specifies a table header</td>
</tr>
</table>
I rarely use <th>
the only use I have for <th> is formatting
heavensgate15
06-16-2009, 08:35 PM
so, you can use either <td> or <th> interchangeably? There is no advantage nor disadvantage in using either the two?
depends on how you want to comfrom to standards and how clean you want your document to be in source view.
'i'd personaly only use <th> for its propper function as a table header.
Judas
06-16-2009, 09:57 PM
It also depends on whether or not you are making a distinction between the two in your stylesheet.
The only real inherent visual difference, as you saw in the code above, is that the <th> tag is naturally bold.
bluewalrus
06-16-2009, 11:36 PM
http://www.w3.org/TR/html401/struct/tables.html#h-11.2.6
sniperman
06-28-2009, 02:10 PM
<th> is used in place of <td> to define a table header. This is used for accessibility purposes for disabled or impaired users. Not everyone can see a table (which makes accessibility for the blind difficult to interpret) so headers are encouraged by W3C accessibility guidelines to help identify and navigate a data table; with a screen reader like JAWS for example.
<td> should only be used for data, and <th> for the values attached to that data.
<tr>
<th scope="col">Artist</th>
<th scope="col">Title</th>
<th scope="col">Price</th>
<th scope="col">Quantity</th>
<th scope="col">Sales</th>
</tr>
<tr>
<td>Bob Dylan</td>
<td>Empire Burlesque</td>
<td>$25.00</td>
<td>6</td>
<td>$150.00</td>
</tr>
<th> also provides print functionality.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.