5. Table #
Created Tuesday 01 September 2020
Tags of table #
table
- basic table tagtr
- row of table- Cells
td
- tag for enclosing a usual data cell.th
- tag for enclosing a header cell, i.e this is only used insidethead
- Sections - optional.
thead
- head of the table, containing headingstbody
- body of the table, containing cellstfoot
- the foot of the table, contains appendices and/or legends.
Code example
<table>
<thead>
<tr>
<th>Name</th> <th>Rank</th>
</tr>
</thead>
<tbody>
<tr>
<td>Optimus</td> <td>Leader</td>
<tr>
<tr>
<td>Bumblebee</td> <td>Lieutenant</td>
<tr>
</tbody>
</table>
Heading Scope #
FIXME - to be included or not. See https://www.w3schools.com/tags/att_th_scope.asp and https://www.codecademy.com/courses/learn-html/lessons/html-tables/exercises/table-headings
Row and column spans attributes #
- There are two attributes that merge space for a cell to take multiple row/column cells.
- Syntax: add
rowspan
/colspan
=“number” to thetd
, the number defines number of cells spanned. Default value is 1 for both, 😁️.
In the diagram here
- Hours has been rowspan set to 6, Sat F has rowspan set to 3, Lunch has colspan set to 5.
- All other corresponding rows/columns have been removed. They are absent.
Border attrbute #
FIXME, to be included or not. I’ll use CSS anyways. Can set this to some integer value, for the table outline.