- Home
- /
- More on HTML Tables
HTML Tutorial
INTRODUCTION
HTML BASIC TAGS
INLINE & BLOCK ELEMENTS
HTML LISTS
HTML TABLES
HTML FORMS
HEAD ELEMENTS
HTML MEDIA
MISCELLANEOUS TAGS
- Home
- /
- More on HTML Tables
More on HTML Tables
Now that you know the basics of HTML tables, let’s explore additional features that enhance the structure, readability, and accessibility of your tables.
Adding a Caption
A table caption serves as the table’s title it improves both accessibility and SEO.
The caption will appear above the table by default.
Example:
Student Details
Grouping Table Sections with <thead>
, <tbody>
,and <tfoot>
You can divide a table into three logical parts:
thead
: Groups header rows.tbody
: Groups main data rows.tfoot
: Groups summary/footer rows.
Name
Age
Ali
25
Sarah
30
End of Table
Styling Column with <colgroup>
and <col>
You can style entire columns using the colgroup
and col
elements.
One
Two
Using the scope
Attribute for Accessibility
The scope
attribute defines whether a header (th)
applies to a row, column, or group. This help screens readers understand table structure.
Name
Age
Ahmed
28
Complete Table Example
Here’s a full example that uses all the advance elements:
Employee Information
ID
Name
Position
Salary
1
Alice
Developer
$80,000
2
Bob
Designer
$70,000
3
Carol
Manager
$90,000
Total Employees
3
Conclusion
By using <thead>
, <tbody>
, <tfoot>
, <colgroup>
, and accessibility features like scope you can build tables that are well-organized, visually clear, and user-friendly-even for screen readers. These features help your tables look professional and behave consistently across browsers.