Tables Flashcards
How do you add a table?
<table><br> <tr><br> <td><td/><br> <td><td/><br> <td><td/><br> </tr><br> <tr><br> <td><td/><br> <td><td/><br> <td><td/><br> </tr><br> </table><br>
This would make a table with two rows and three columns.
You create a table by adding rows <tr> and then an individual table data tag <td> for each cell in the table
When would we add a table
Displaying sports results
Tabular information
Financial Information
Display information in a grid format
How do we add a table header tag
<th>
This can take a scope attribute to indicate if its a header for a row or column
</th>
Do I need to add a td tag if that cell would not have any content?
Yes, otherwise the table won’t render correctly
How can we make a data spread across multiple rows or columns?
Use the rowspan and colspan attributes.
These take a number as the value.
When using these attributes you don’t need to include an empty td tag for the row/column that’s being spanned over.
What extra elements can we use if we have a long table
<thead>
<tbody>
<tfooter>
</tfooter></tbody></thead>