+ 3

whats the difference between <td> and <th>?

i mean we use both of them for creating table cells,isn't it? so...

5th Jul 2017, 6:42 PM
Hamed Nabilou
Hamed Nabilou - avatar
6 ответов
+ 18
According to ThoughtCo : The <td> tag, or "table data" tag, creates table cells within a table row in an HTML table. This is the HTML tag that contains any text and images. Basically, this is the workhouse tags of your table. The tags will contain the content of the HTML table. The <th> tag, or "table header", is similar to the <td> in many ways. It can contain the same kind of information (although you wouldn't put an image in a <th>), but it defines that specific cell as a table header.
5th Jul 2017, 6:46 PM
Dev
Dev - avatar
+ 4
TH is the header cells at top. TD is the data cells. But yes, they're both making cells, you'll want to use the TH one to signify the row you used for headers.
5th Jul 2017, 6:44 PM
AgentSmith
+ 4
<td> or table data tag contains the content of html table any text and image. <th> or table header also contains same kind of information (although we wouldn't put an image in <th>).It defines that specific cell as a table header.
29th Jul 2017, 10:04 AM
Nikhila Tammu
Nikhila Tammu - avatar
+ 2
Joke answer: One spelled with 'd' and one with 'h'.
6th Jul 2017, 12:52 AM
Jamie
Jamie - avatar
+ 1
Using Th for a header cell just makes your code easier to maintain and read. It's basically up to you what you use.
5th Jul 2017, 6:48 PM
JayAge
0
The <td> element: The<td> tag specifies text in acell of a table.It is container tag. This tag is used inside <tr> tag, which is nested inside the <table> tag. The number of columns in a table depends on the number of the <td> elements within the <tr> element. The <th> element The <th> tag is used to create headings in a table. This is a container element. It specifies a table cell whose contents are usually displayed in a bolder font than those of the regular table cells. Note:-The only difference between the <td> and the <th> tag is that the text is displayed in a roman font (not bold) in <td>, while it is displayed in the bold font by the <th> tag.
14th Dec 2023, 8:14 AM
Adya Rath