🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

HTML Tables

Web FoundationsđŸŸĸ Free Lesson

Advertisement

HTML Tables

Table structure, accessibility, responsive tables, and data display.

Overview

Tables organize tabular data in a structured, accessible format.

Key Concepts

  • Table Structure — <table>, <thead>, <tbody>, <tfoot>
  • Accessibility — <caption>, <th>, scope attributes
  • Responsive Design — Tables that work on mobile
  • Data Display — Sorting and formatting data
  • CSS Styling — Making tables visually appealing

Code Examples

<table>
  <caption>Monthly Sales Report</caption>
  <thead>
    <tr>
      <th scope="col">Month</th>
      <th scope="col">Revenue</th>
      <th scope="col">Expenses</th>
      <th scope="col">Profit</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">January</th>
      <td>$10,000</td>
      <td>$7,000</td>
      <td>$3,000</td>
    </tr>
    <tr>
      <th scope="row">February</th>
      <td>$12,000</td>
      <td>$8,000</td>
      <td>$4,000</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <th scope="row">Total</th>
      <td>$22,000</td>
      <td>$15,000</td>
      <td>$7,000</td>
    </tr>
  </tfoot>
</table>
```css
/* Responsive table */
.table-wrapper &#123;
  overflow-x: auto;
&#125;

table &#123;
  width: 100%;
  border-collapse: collapse;
&#125;

th, td &#123;
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
&#125;

th &#123;
  background-color: #f5f5f5;
  fontWeight: bold;
&#125;

tr:hover &#123;
  background-color: #f9f9f9;
&#125;

Practice

Create an accessible, responsive data table with sorting functionality.

Need Expert Web Development Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement