TGViewer
Web Development Web Development @webdevcoursefree ยท 79.7K subscribers
Post #4088 192
๐ŸŒ Web Development Roadmap โ€” Part 19

HTML Tables

Tables are used to display information in rows and columns.

For example, a website might use a table to display:

โ€ข Employee information

โ€ข Product details

โ€ข Exam results

โ€ข Prices

โ€ข Sales data

โ€ข Schedules

1. Basic Table Structure

A simple HTML table looks like this:

<table>
<tr>
<th>Name</th>
<th>Role</th>
</tr>

<tr>
<td>Rahul</td>
<td>Developer</td>
</tr>

<tr>
<td>Priya</td>
<td>Designer</td>
</tr>
</table>


The structure is:

<table>
โ†“
<tr> โ†’ Table Row
โ†“
<th> โ†’ Header Cell
<td> โ†’ Data Cell


2. <table>

The <table> element defines the entire table.

<table>
...
</table>


Everything belonging to the table goes inside it.

3. <tr> โ€” Table Row

<tr> creates a row.

<tr>
<td>Rahul</td>
<td>Developer</td>
</tr>


Each <tr> represents one horizontal row.

4. <th> โ€” Table Header

<th> represents a header cell.

<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>


Browsers typically display header cells in bold.

5. <td> โ€” Table Data

<td> represents normal data.

<tr>
<td>Rahul</td>
<td>25</td>
<td>Pune</td>
</tr>


6. Understanding the Structure

Consider:

<table>
<tr>
<th>Name</th>
<th>Department</th>
</tr>

<tr>
<td>Amit</td>
<td>Finance</td>
</tr>
</table>


7. <thead>, <tbody> and <tfoot>

For larger or more structured tables, HTML provides sections.

<table>

<thead>
<tr>
<th>Product</th>
<th>Price</th>
</tr>
</thead>

<tbody>
<tr>
<td>Laptop</td>
<td>โ‚น60,000</td>
</tr>

<tr>
<td>Phone</td>
<td>โ‚น30,000</td>
</tr>
</tbody>

<tfoot>
<tr>
<td>Total</td>
<td>โ‚น90,000</td>
</tr>
</tfoot>

</table>


The structure becomes:

<table>
โ”œโ”€โ”€ <thead>
โ”‚ โ””โ”€โ”€ Header rows
โ”‚
โ”œโ”€โ”€ <tbody>
โ”‚ โ””โ”€โ”€ Main data rows
โ”‚
โ””โ”€โ”€ <tfoot>
โ””โ”€โ”€ Summary/footer rows


8. colspan

colspan allows a cell to span multiple columns.

<tr>
<td colspan="2">Total Sales</td>
</tr>


Here the cell occupies two columns.

9. rowspan

rowspan allows a cell to span multiple rows.

<tr>
<td rowspan="2">Finance</td>
<td>Rahul</td>
</tr>

<tr>
<td>Priya</td>
</tr>
  • โค 1
More from @webdevcoursefree
  1. Oct 17, 2026The Finance cell spans two rows. 10. Tables vs Layout Tables should be used for tabular daโ€ฆ
  2. Oct 17, 2026๐—œ๐—•๐—  ๐—™๐—ฅ๐—˜๐—˜ ๐—ง๐—˜๐—–๐—› ๐—–๐—ข๐—จ๐—ฅ๐—ฆ๐—˜๐—ฆ ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ! ๐ŸŽ“ Explore IBM Cognitive Class and buildโ€ฆ
  3. Oct 16, 2026๐——๐—ฎ๐˜๐—ฎ ๐˜€๐—ฐ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ช๐—ถ๐˜๐—ต ๐—”๐—œ๐Ÿ˜ Future Ready Data Scienโ€ฆ
  4. Oct 16, 2026๐ŸŒ Web Development Roadmap โ€” Part 18 HTML Lists Lists are used whenever information needsโ€ฆ
  5. Oct 14, 2026๐ŸŒ Web Development Roadmap โ€” Part 17 HTML Images โ€” <img> Tag Images make webpages more visโ€ฆ
  6. Oct 13, 2026๐—ง๐—ข๐—ฃ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ข๐—จ๐—ฅ๐—ฆ๐—˜๐—ฆ ๐—ง๐—ข ๐—•๐—ข๐—ข๐—ฆ๐—ง ๐—ฌ๐—ข๐—จ๐—ฅ ๐—ฆ๐—ž๐—œ๐—Ÿ๐—Ÿ๐—ฆ ๐—œ๐—ก ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ! Explorโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’