<th> vs <td>

gudii9
gudii9 used Ask the Experts™
on
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?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017
Commented:
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
Bill PrewIT / Software Engineering Consultant
Top Expert 2016
Commented:
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
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>
Digital Marketing
Commented:
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>

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial