ALL LESSONS Module 6

Creating Tables in HTML

Apr 4, 2026 1 min read

Basic Table Structure

Use <table>, <tr>, <th>, and <td> to create tables. Tables organize data into rows and columns.

Example

<table>
  <tr>
    <th>Name</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>John</td>
    <td>25</td>
  </tr>
</table>

Use Cases

Tables are useful for presenting structured data such as:

  • Class schedules
  • Price lists
  • Statistics or reports

Best Practices

  • Accessibility: Always use <th> for headers so screen readers can interpret data correctly.
  • Styling: Use CSS to style tables (borders, spacing, colors) instead of inline attributes.
  • Keep it simple: Avoid using tables for layout — they should be reserved for tabular data.

Hands?On Exercise

Create a table with three columns: Product, Price, and Availability. Add at least two rows of data. Practice using <th> for headers and <td> for cells.

Need help with this lesson? Visit the Discussion Forum