HTML Tutorial Part 3. How To Use Tables In HTML
Posted by TotalDCIn HTML tutorial part 2 we talked about some of the basics for creating your first simple web page. Now let’s talk about how and where you can use tables in HTML.
Tables in HTML
A table is a structured representation of certain data, represented by rows and columns. Data is inserted in cells of the table. A cell is an intersection of a row and a column. Vertical lines are called columns and horizontal lines are called rows.
A table in HTML can be created with <table></table> tags. To add a row to a table type <tr></tr> which stands for table row. Then columns are generated automatically based on the data you provide. Data is inserted with <td></td> tags which stands for table data. Table headings can be added with <thead></thead> or <th></th>.
<!DOCTYPE html>
<html>
<head>
<title>Images</title>
</head>
<body>
<table>
<th>
<tr>
<td>Table Header1</td>
<td>Table Header2</td>
<td>Table Header3</td>
</tr>
</th>
<tr>
<td>column1</td>
<td>column2</td>
<td>column3</td>
</tr>
<tr>
<td>column1</td>
<td>column2</td>
<td>column3</td>
</tr>
<tr>
<td>column1</td>
<td>column2</td>
<td>column3</td>
</tr>
</table>
</body>
</html>
The result of the code above would look like: