How to decide when to use <th> or when not? in <table>
As for this code
<table id="presentationsContainer">
<tr>
<td class="main" width="60%">Presentation October 2009</td>
<td class="dl" width="20%">Download pdf</td>
<td class="dl" width="20%">Download ppt</td>
</tr>
<tr>
<td class="main" width="60%">Presentation October 2009</td>
<td class="dl" width="20%">Download pdf</td>
<td class="dl" width="20%">Download ppt</td>
</tr>
<tr>
<td class="main" width="60%">Presentation October 2009</td>
<td class="dl" width="20%">Download pdf</td>
<td class="dl" width="20%">Download ppt</td>
</tr>
</table>
+3
4 answers
The table title tag should be used when talking about header data. If there was a row in your table that served as an explanation for the content in the remaining rows, you should specify that row with th. It seems that your code probably does not require one, because all the information is already in the table. Something like this would be a suitable use of th.
<table id="presentationsContainer">
<tr>
<th>Presentation</th>
<th>PDF</th>
<th>PPT</th>
</tr>
<tr>
<td class="main" width="60%">October 2009</td>
<td class="dl" width="20%">Download</td>
<td class="dl" width="20%">Download</td>
</tr>
<tr>
<td class="main" width="60%">October 2009</td>
<td class="dl" width="20%">Download</td>
<td class="dl" width="20%">Download</td>
</tr>
<tr>
<td class="main" width="60%">October 2009</td>
<td class="dl" width="20%">Download</td>
<td class="dl" width="20%">Download</td>
</tr>
</table>
Sorry if I misunderstood the question. There are not many explanations.
+4
th .
, 2009 , HTML :
<table id="presentationsContainer">
<tr>
<th class="main" width="60%">Presentation October 2009</th>
<td class="dl" width="20%">Download pdf</td>
<td class="dl" width="20%">Download ppt</td>
</tr>
<tr>
<th class="main" width="60%">Presentation October 2009</th>
<td class="dl" width="20%">Download pdf</td>
<td class="dl" width="20%">Download ppt</td>
</tr>
<tr>
<th class="main" width="60%">Presentation October 2009</th>
<td class="dl" width="20%">Download pdf</td>
<td class="dl" width="20%">Download ppt</td>
</tr>
</table>
, html , CSS , :
#presentationsContainer table tr th {
width: 60%;
}
#presentationsContainer table tr td {
width: 20%;
}
+4