Know and understand the reason tables are used to structure elements within a web page
21 Website Authoring: Tables in Web Pages
What is a Table?
A table is a grid made up of rows and columns that can hold data or organise content on a web page. Think of it like a spreadsheet or a Lego grid where each block (cell) can contain text, images, or even other elements.
Why Use Tables?
- 📊 Data Presentation: Tables are perfect for showing numbers, lists, or any data that needs to be compared side‑by‑side.
- 🗂️ Logical Structure: They help browsers and assistive technologies understand the relationship between pieces of information.
- 🛠️ Legacy Layout: Older websites used tables to create multi‑column layouts before CSS became mainstream.
Table Example – Data
| Student | Math | English | Science |
|---|---|---|---|
| Alice | 88 | 92 | 85 |
| Bob | 76 | 81 | 79 |
Table Example – Layout (Legacy)
| Sidebar | Main Content | Ads |
Exam Tips 📚
- Use
<table>only for tabular data. For page layout, rely on CSS. - Always include
<thead>and<tbody>for accessibility. - Remember that
<th>cells are bold and centered by default – great for column headings. - Use
border-collapse: collapse;to remove double borders. - Check the exam question: if it asks for “displaying data”, a table is likely the answer.
Analogy: Tables as Lego Bricks
Imagine building a city with Lego bricks. Each brick (cell) can be a house, a tree, or a road. When you stack them in rows and columns, you create a whole city (the table). Just like how you choose the right brick for the right spot, you choose the right table cell for the right piece of information.
Revision
Log in to practice.
3 views
0 suggestions