C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
HTML <td> tagHTML <td> tag is used to specify the cells of an HTML table which contain 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. The grouped <td> elements of a <tr> tag renders as a single row in the table. The content of the <td> elements is regular and left-aligned in the table by default. Syntax<td>.......</td>
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML td tag</title>
<style>
th{
background-color: #6495ed;
}
th,td{
border: 1px solid black;
padding: 10px;
}
</style>
</head>
<body>
<h2>Example of td Tag</h2>
<table style=" border-collapse: collapse; background-color:#dcdcdc;">
<tr>
<th>Product</th>
<th>Quantity</th>
<th>Price</th>
</tr>
<tr>
<td>Books</td>
<td>5</td>
<td>589</td>
</tr>
<tr>
<td>T-shirt</td>
<td>5</td>
<td>3500</td>
</tr>
<tr>
<td>Jeans</td>
<td>2</td>
<td>5000</td>
</tr>
</table>
</body>
</html>
Output:
Attribute:
Tag-specific attributes:
Global attribute:The <td> tag supports the Global attributes in HTML. Event attribute:The <td> tag supports the Event attributes in HTML. Supporting Browsers
Next TopicHTML template Tag
|