Book HomeCascading Style Sheets: The Definitive GuideSearch this book Sunday 26th of June 2016 01:05:00 AM

10.7. Tables

Perhaps as a result of a generic need to be able to describe table layout -- something CSS1 lacks -- CSS2 includes a handful of features that apply directly to tables and table cells. First, there are 10 new table-related values for display:

table
inline-table
table-column-group
table-column
table-row-group
table-row
table-cell
table-caption

H1 {font-variant: small-caps;}
Figure 5-30

Figure 5-30. Legal, if not optimal, rendering of small caps

WARNING

Of the browsers which even recognize font-variant:small-caps (Explorer 4 and 5, and Opera 3.5), onlyOpera and IE5 for Macintosh do what authors would expect in thedisplay of the text. Other versions of Explorer take the all-capitalsroute.

table-header-group table-footer-group

While the effects of most of these are obvious from their names, at least two may not be familiar to you. table-header-group and table-footer-group are used to mark the header and footer of a table. These are displayed, respectively, above or below all the rows of the table, but not outside of the table's caption.

Another interesting effect is that you can align text on a character by using the text-align property. For example, if you wanted to line up a column of figures on a decimal point, you might declare:

TD { text-align: "." }

As long as a set of cells are grouped into a column, their content will be aligned so that the periods all line up along a vertical axis.

Far from relying on existing properties, CSS2 provides a whole array of brand-new properties in the table section. Here are a few of them:

There are also properties describing how visibility and vertical-align are applied to tables. There is also a caption-side property, which functions exactly the same as the ALIGN attribute on the <CAPTION> tag, and the property speak-header-cell, which controls how header cells are handled by speech-generating browsers (more on that later).



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.

does very much. In fact, it's very useful if you suddenly decide that you want all of your H1 elements to be all capitals. Instead of having to actually change the content of all your H1 elements, you can just use text-transform to make the change for you:

H1 {text-transform: uppercase;}
<H1>This is an H1 element</H1>

As you can see from Figure 4-55, the text is now all capitals.