• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

<th> vs <td>

In the html world what is difference between
<th> vs <td>

when we use each under <tr> of <table>
please advise
can i use one another interchangeably?
0
gudii9
Asked:
gudii9
4 Solutions
 
Leonidas DosasCommented:
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 element with the most usage .
The <th> is similar of <td> but we using it as a header of a table column
0
 
Bill PrewCommented:
The Mozilla Developer Network (MDN) is a great resource for information about HTML among other things.  Take a look at the page linked below for a good discussion on tables.



»bp
0
 
zc2Commented:
Default style of <th> elements is "font-weight: bold; "
You supposed to use <th>  inside <thead>, but actually it could be used instead of any <td>
0
 
BRMarketingCommented:
The <th> tag defines a header cell in an HTML table.

An HTML table has two kinds of cells:

Header cells - contains header information (created with the <th> element)
Standard cells - contains data (created with the <td> element)
The text in <th> elements are bold and centered by default.

The text in <td> elements are regular and left-aligned by default.

Example:

<table>
 <tr>
   <th>Month</th>
   <th>Savings</th>
 </tr>
 <tr>
   <td>January</td>
   <td>$100</td>
 </tr>
</table>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now