HTML
Hypertext Markup Language
HTML represents a basic table using four elements.
Tags | Description |
---|---|
<TABLE> | This <TABLE>, contains one or more rows. |
<TR> | Table row element. The number of rows in the table is determined by the number of occurrences of the <TR> element. |
<TD> | Table data element. The number of columns in a table is determined by the maximum number of data cells indicated by <TD> </TD> |
<TH> | Table heading. Headings indicatead by <TH> with in the table. It may be useful to hint to the browser at the number of columns in the table by setting the COLS attribute. |
<CAPTION> | The table may have a caption enclosed with <CAPTION> ... </CAPTION>, whose contents are generally rendered above or below the table indicating what the table contains. |
HTML Code
<html>
<head>
<title>table</title>
</head>
<body>
<table border="1">
<caption> Basic Fruit Comparison Chart </caption>
<tr>
<th>Fruit</th> <th>Color</th> </tr>
<tr>
<td>Apple</td> <td>Red</td> </tr>
<tr>
<td>Avocado</td> <td>Green</td> </tr>
<tr>
<td>Watermelon</td> <td>Pink</td> </tr>
</table> </body>
</html>
<head>
<title>table</title>
</head>
<body>
<table border="1">
<caption> Basic Fruit Comparison Chart </caption>
<tr>
<th>Fruit</th> <th>Color</th> </tr>
<tr>
<td>Apple</td> <td>Red</td> </tr>
<tr>
<td>Avocado</td> <td>Green</td> </tr>
<tr>
<td>Watermelon</td> <td>Pink</td> </tr>
</table> </body>
</html>
Output
Fruit | Color |
---|---|
Apple | Red |
Avocado | Green |
Watermelon | Pink |