• Tables are defined with the <table>
  • Tables are divided into table rows with the <tr>
  • Table rows are divided into table datawith the <td>
  • A table row can also be divided into table headingswith the <th>

Example 1:

[copya id=”link_8260357434″ target=”8260357434″]Copy it[/copya]
[t_block id=”8260357434″ filename=”8260357434″]<html>
<body>
<table style=”width:100%; background: whitesmoke;”>
<tr>
<td>Seattle</td>
<td>John</td>
</tr>
<tr>
<td>Spokane</td>
<td>Peter</td>
</tr>
<tr>
<td>Tacoma</td>
<td>David</td>
</tr>
</table>
</body>
</html>[/t_block]

<table> Defines a table
<th> Defines a header cell in a table
<tr> Defines a row in a table
<td> Defines a cell in a table
<caption> Defines a table caption
<colgroup> Specifies a group of one or more columns in a table for formatting
<col> Specifies column properties for each column within a <colgroup> element
<thead> Groups the header content in a table
<tbody> Groups the body content in a table
<tfoot> Groups the footer content in a table

 

Example 2:

[copya id=”link_5357676460″ target=”5357676460″]Copy it[/copya]
[t_block id=”5357676460″ filename=”5357676460″]<!DOCTYPE html>
<html>
<head>
<title>HTML Table Background</title>
</head>
<body>
<table border=”1″ bordercolor=”green” bgcolor=”yellow”>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
<tr>
<td rowspan=”2″>Row 1 Cell 1</td>
<td>Row 1 Cell 2</td><td>Row 1 Cell 3</td>
</tr>
<tr>
<td>Row 2 Cell 2</td><td>Row 2 Cell 3</td>
</tr>
<tr>
<td colspan=”3″>Row 3 Cell 1</td>
</tr>
</table>
</body>
</html>[/t_block]