|
Definition and UsageThe An HTML table has two kinds of cells:
The text in The text in <th> elements are bold and centered by default. Browser Support
Attributes
Global AttributesThe Event AttributesThe |
<table>
<tr>
<td>Cell A</td>
<td>Cell B</td>
</tr>
<tr>
<td>Cell C</td>
<td>Cell D</td>
</tr>
</table>
Right-align content in some data cells
<table style="width:100%">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td style="text-align:right">$100</td>
</tr>
<tr>
<td>February</td>
<td style="text-align:right">$80</td>
</tr>
</table>
Add Background Color to td
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td style="background-color:#FF0000">January</td>
<td style="background-color:#00FF00">$100</td>
</tr>
</table>
Add Specific Height to td
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td style="height:100px">January</td>
<td style="height:100px">$100</td>
</tr>
</table>
Add Nowrap to td
<table>
<tr>
<th>Poem</th>
</tr>
<tr>
<td style="white-space:nowrap">Never increase, beyond what is necessary, the number of entities required to explain anything</td>
</tr>
</table>
Vertical-align content in td
<table style="width:50%;">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr style="height:100px">
<td style="vertical-align:bottom">January</td>
<td style="vertical-align:bottom">$100</td>
</tr>
</table>
Add a width i percent for tds
<table style="width:100%">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td style="width:70%">January</td>
<td style="width:30%">$100</td>
</tr>
</table>
<table>
<tr>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
</tr>
<tr>
<td>John Doe</td>
<td>[email protected]</td>
<td>123-45-678</td>
</tr>
</table>
The caption element
<table>
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
<table>
<tr>
<th>Name</th>
<th>Email</th>
<th colspan="2">Phone</th>
</tr>
<tr>
<td>John Doe</td>
<td>[email protected]</td>
<td>123-45-678</td>
<td>212-00-546</td>
</tr>
</table>
Most browsers will display the <td> element with the following default values.
<style>
td {
display: table-cell;
vertical-align: inherit;
}
</style>
<table>
<tr>
<td>Cell A</td>
<td>Cell B</td>
</tr>
<tr>
<td>Cell C</td>
<td>Cell D</td>
</tr>
</table> | html td |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Tag |
Uploaded by: | Admin |
Read Articlehttps://develop.horje.com/learn/1434/reference