In: Computer Science
I'm having trouble with validating this html code. Whenever I used my validator, it says I have a stray end tag: (tbody) from line 122 to 123. It's the last few lines. Thanks and Ill thumbs up whoever can help solve my problem.
Here's my code:
<!DOCTYPE html>
<html lang="en">
<head>
<title>L7 Temperatures Fields</title>
<!--
Name:
BlackBoard Username:
Filename: (items left blank for bb reasons
Class Section: (blank)
Purpose: Making a table to demonstrate my ability in
the use of table data-->
<meta charset = "utf-8" />
<style>
table , th, td {
border: 2px solid black;
border-collapse: collapse;
}
</style>
</head>
<table>
<thead>
<tr>
<th colspan = "1" scope = "col">Month</th>
<th colspan = "1" scope =
"col">High</th>
<th colspan = "1" scope =
"col">Low</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan = "3"> Winter
Season</th>
</tr>
<tr>
<td>December</td>
<td>56</td>
<td>37</td>
</tr>
<tr>
<td>January</td>
<td>51</td>
<td>31</td>
</tr>
<tr>
<td>February</td>
<td>55</td>
<td>34</td>
</tr>
<tr>
<th colspan = "3"> Spring
Season</th>
</tr>
<tr>
<td>March</td>
<td>62</td>
<td>40</td>
</tr>
<tr>
<td>April</td>
<td>73</td>
<td>50</td>
</tr>
<tr>
<td>May</td>
<td>82</td>
<td>60</td>
</tr>
<tr>
<th colspan = "3"> Summer
Season</th>
</tr>
<tr>
<td>June</td>
<td>89</td>
<td>67</td>
</tr>
<tr>
<td>July</td>
<td>92</td>
<td>71</td>
</tr>
<tr>
<td>August</td>
<td>89</td>
<td>70</td>
</tr>
<tr>
<th colspan = "3"> Autumn
Season</th>
</tr>
<tr>
<td>September</td>
<td>84</td>
<td>65</td>
</tr>
<tr>
<td>October</td>
<td>73</td>
<td>52</td>
</tr>
<tr>
<td>November</td>
<td>61</td>
<td>40</td>
</tr>
<tfoot>
<tr>
<th colspan = "3">12 Month Average Temperatures
(Year)</th>
</tr>
<tr>
<td>72</td>
<td>51</td>
<td></td>
</tr>
</tfoot>
</tbody>
</table>
An HTML table with a <thead>,<tbody>,<tfoot> different elements.
So, You have to close the <tbody> element before the <tfoot> element. But you closed after the <tfoot> element so validater says I have a stray end tag: (tbody) from line 122 to 123.
Once we can validate the below program then you can get valid results.
<!DOCTYPE html>
<html lang="en">
<head>
<title>L7 Temperatures Fields</title>
<!--
Name:
BlackBoard Username:
Filename: (items left blank for bb reasons
Class Section: (blank)
Purpose: Making a table to demonstrate my ability in the use of
table data-->
<meta charset = "utf-8" />
<style>
table , th, td {
border: 2px solid black;
border-collapse: collapse;
}
</style>
</head>
<table>
<thead>
<tr>
<th colspan = "1" scope = "col">Month</th>
<th colspan = "1" scope = "col">High</th>
<th colspan = "1" scope = "col">Low</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan = "3"> Winter Season</th>
</tr>
<tr>
<td>December</td>
<td>56</td>
<td>37</td>
</tr>
<tr>
<td>January</td>
<td>51</td>
<td>31</td>
</tr>
<tr>
<td>February</td>
<td>55</td>
<td>34</td>
</tr>
<tr>
<th colspan = "3"> Spring Season</th>
</tr>
<tr>
<td>March</td>
<td>62</td>
<td>40</td>
</tr>
<tr>
<td>April</td>
<td>73</td>
<td>50</td>
</tr>
<tr>
<td>May</td>
<td>82</td>
<td>60</td>
</tr>
<tr>
<th colspan = "3"> Summer Season</th>
</tr>
<tr>
<td>June</td>
<td>89</td>
<td>67</td>
</tr>
<tr>
<td>July</td>
<td>92</td>
<td>71</td>
</tr>
<tr>
<td>August</td>
<td>89</td>
<td>70</td>
</tr>
<tr>
<th colspan = "3"> Autumn Season</th>
</tr>
<tr>
<td>September</td>
<td>84</td>
<td>65</td>
</tr>
<tr>
<td>October</td>
<td>73</td>
<td>52</td>
</tr>
<tr>
<td>November</td>
<td>61</td>
<td>40</td>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan = "3">12 Month Average Temperatures
(Year)</th>
</tr>
<tr>
<td>72</td>
<td>51</td>
<td></td>
</tr>
</tfoot>
</table>
NOTE:***I hope you understand my answer if you have any doubts please comment me.......Thank you......*****