+ 3
whats the difference between <td> and <th>?
i mean we use both of them for creating table cells,isn't it? so...
6 Respuestas
+ 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.
+ 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.
+ 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.
+ 2
Joke answer: One spelled with 'd' and one with 'h'.
+ 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.
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.