Assessment wanted for Structuring planet data and the answer to one question

Assessment wanted for Structuring planet data and the answer to one question

Link to task: https://developer.mozilla.org/en-US/docs/Learn/HTML/Tables/Structuring_planet_data

Link to my code: https://jsfiddle.net/EiNzp/vd4810kb/3/

Question:
My code, line 22, 36 and 37:
22: <th id="Name">Name</th>
36: <th colspan="2" rowspan="4" id="Terrestrial-planets">Terrestrial planets</th>
37: <th id="Mercury">Mercury</th>

Would it be a mistake to make line 37 like this:
<th id="Mercury" headers="Terrestrial-planets Name">Mercury</th>
Or for <th> it is incorrect to set “headers”?

Hi @EiN

Great job on this exercise. Everything looks correct.
Regarding your question, I think this would be a good idea, because headers is also allowed on <th>.

On a general note: I would recommend using the scope attribute on the <th>s instead of headers on the <td>s. That would have saved you a lot of typing. :grin:
Here are two examples:

  • <th scope="col">Diameter (km)</th> :arrow_right: We tell the browser/screen reader that this header applies to the column
  • <th rowspan="4" colspan="2" scope="rowgroup">Terrestrial planets</th> :arrow_right: This header applies to a group of rows (since we have a rowspan attribute)

I hope that helps. Feel free to ask more questions, if something is unclear.

Cheers,
Michael

1 Like