tables Flashcards
1
Q
Which tag will you use to define table header?
A
‹thead› is used to define table header.
And [th] for the actual headings
2
Q
How will you group columns in a table for formatting?
A
The ‹colgroup› tag can be used for the same. e.g. ‹table› ‹colgroup span="2" align="left"›‹/colgroup› ‹colgroup align="right"›‹/colgroup› ‹tr› ‹th›Id‹/th› ‹th›Name‹/th› ‹th›Location‹/th› ‹/tr› ‹tr› ‹td›1‹/td› ‹td›Ben‹/td› ‹td›Sydney‹/td› ‹/tr› ‹/table›
3
Q
Can ‹colgroup› be nested with other tags apart from table element?
A
No. The ‹colgroup› tag can only be used inside a table element.
4
Q
How will you create columns in a table?
A
To create columns, we must specify td elements within a tr element. e.g.‹tr›‹td›Col1‹/td›‹td›Col2‹/td›‹/tr›
5
Q
Name the tags with which tfoot tag should be used in conjunction with.
A
The tfoot element should be used in conjunction with the thead and tbody tags.
6
Q
Where will you place ‹tfoot› tag in your HTML page?
A
The ‹tfoot› tag must appear before ‹tbody› within a table, so that a browser can render the footer before receiving all the rows of data. e.g. ‹table border="1"› ‹thead› ‹tr› ‹th›Subject‹/th› ‹th›Marks‹/th› ‹/tr› ‹/thead› ‹tfoot› ‹tr› ‹td›Total‹/td› ‹td›150‹/td› ‹/tr› ‹/tfoot› ‹tbody› ‹tr› ‹td›English‹/td› ‹td›100‹/td› ‹/tr› ‹tr› ‹td›Maths‹/td› ‹td›50‹/td› ‹/tr› ‹/tbody› ‹/table›