Table Data & Table Headings


#1


I'm confused as to why/when to choose to use the Table Headings and Table Data elements. They both run perfectly fine performing the other one's task:
I'm able to add Data using the Table Heading element and am able to add Headings using Table Data element. I'm thinking the Table Data and Table Heading elements are both essentially used for code readability more than exclusive code-element functionality??

Any help is appreciated.
Many thanks!

https://www.codecademy.com/courses/learn-html-css/lessons/tables/exercises/rowspan


Morning
Study
Study


Morning
Study
Study


 <tr> <!-- Row 2 -->
    <th>Morning</th>
    <th rowspan="3"> Study </th>
    <th rowspan="3"> Study </th>
  </tr>

 <tr> <!-- Row 2 -->
    <td>Morning</td>
    <td rowspan="3"> Study </td>
    <td rowspan="3"> Study </td>
  </tr>


#2

Yes,

You're correct, th makes it bold and leaves a bigger gap so you can see that's the heading.

As mention on the MDN website its an optional tag,

But why would you want to leave it out, the table doesn't look good without it :slight_smile:


#3

Okay, that's what I thought!

Thank you so much for your response!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.