When using row groups, you can have one or more tbody elements and zero or one thead
and tfoot elements. They should be ordered with the head first, foot second, and
THE ESSENTIAL GUIDE TO CSS AND HTML WEB DESIGN
240
body/bodies third, thereby enabling the browser to render the foot prior to receiving all
of the data. Note, however, that despite this order in HTML, browsers visually render the
row groups in the order you??™d expect: head, body, and foot.
Scope and headers
Although table header cells provide a means of differentiating headers and other data, a
direct means of associating one with the other can be added via the use of various attributes.
For simple data tables, the scope attribute, added to table headers, provides an indication
of which data a heading refers to. For example, in the previous code block, the
table is oriented in columns??”the headers are above their associated data. Therefore,
adding a scope attribute to the header cells, with a value of col, clearly defines this relationship
??”and this is something that comes in handy for screen readers.
Country | Capital city | France | Paris | If the alignment of the table were changed, with the headers at the left, the row value
would instead be used.
Country | France | Capital city | Paris | Note that if a table header contains colspan or rowspan attributes??”for example, if a
header, such as food, spanned two columns (thereby having the attribute/value pair
colspan="2") and had underneath two further headings, such as fruit and vegetables??”
you could set scope="colgroup" in the table header start tag.
Pages:
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338