HTML Tutorial Part 3. How To Use Tables

Posted by TotalDC

In HTML tutorial part 2 we talked about some of the basics for creating your first simple web page. Now lets talk about tables.

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 and 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 row to a table type <tr></tr> which stands for table row. And 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>

Result of the code above would look like

html table example

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: