HTML TD Tag || TD Tag in HTML
×

HTML TD <td> Tag

0 426

The HTML TD <td> tag represents a data cell (or table data) of an HTML table which contains data of the table. The <td> tag must be the child element of <tr> (table row) tag. Each table row can contain multiple <td> data elements.

An HTML table has two kinds of cells:

  1. One is Header cells - it contains header information (created with the <th> element)
  2. Second is Standard cells - it contains data (created with the <td> element)

The text in <th> elements are bold and centered by default in HTML document.

The text in <td> elements are regular and left-aligned in HTML document.


Syntax:

The <td> tag is written as <td></td> with the table data inserted between the start and end tags.

Program:

<!DOCTYPE html>
<html>
<head>
<title>HTML TD Tag</title>
</head>
<body>
 <h2>Example of TD Tag</h2>
<table style=" border-collapse: collapse;">
 <tr>
<th>Product</th>
<th>Quantity</th>
<th>Price</th>
 </tr>

<tr>
<td>Books</td>
<td>45</td>
 <td>111</td>
</tr>

<tr>
 <td>T-Shirt</td>
 <td>52</td>
 <td>500</td>
</tr>

<tr>
<td>Jeans</td>
<td>12</td>
 <td>2100</td>
</tr>
</table>
</html>

Output:




Share:


Leave a Reply


Comments
    Waiting for your comments