Grouping Table Columns: The col Elementfor better management and accessibility. The first of these elements is the col element. The col element is a way to group columns to specify attributes or apply style. The colspan attribute, which defines how many columns the col element will span. Example 4-14 demonstrates the use of the col element with a span attribute of 2. You'll notice I've also added the width attribute, defining a width, and that the col element requires a trailing slash: <col />. Example 4-14. Using the col element to apply attributes to a number of columns<table width="90%" border="1" cellspacing="5" cellpadding="5" summary="This table explores Figure 4-15 demonstrates how the first two columns are now grouped. The width I've defined in the col element of 100 pixels applies to both columns in the spanned group. Figure 4-15. Grouping columns using the col element.
You can add other presentational attributes, too, including the align and valign attributes: <col span="2" width="100" align="right" valign="bottom" /> This markup creates the results found in Figure 4-16. Figure 4-16. Using the col element to apply presentational attributes to multiple columns.
group than it is in the right column, which isn't part of the group. |
| |||||||||||||||||||