Thank you for all the suggestions.
>-----Original Message----- >From: [email protected] [mailto:[email protected] >discuss.org] On Behalf Of Jukka K. Korpela >Sent: Tuesday, November 08, 2011 10:07 AM >To: [email protected] >Subject: Re: [css-d] how to center "some" table columns > >11/8/2011 3:29 AM, Philippe Wittenbergh wrote: > > >> In the table linked to below, I would like to center >> the third, fourth, >and fifth columns of data. >[...] > >> http://www.sbctc.ctc.edu/college/_f- >tuitionwaivers_runningstartNEW.aspx > > > > td:first-child + td + td, > > td:first-child + td + td + td, > > td:first-child + td + td + td + td {text-align: center;} [1] > >That's how to do it using general techniques, but in special cases, we can cut >down the stylesheet by applying negative thinking: > >td { text-align: center; } >td:first-child, td:first-child + td { text-align:left; } > >That is, declare all cells as centered, then handle those (here, 1st and 2nd >column) that shouldn't be centerd. > > > Yeah, I know HTML4 allows for the 'align' attribute on <col>, > but except >for IE in quirks mode, it doesn't work anywhere. > >It's still a useful precaution, since older versions of IE are not yet >extinct. It's >simple to specify > ><col> ><col> ><col align=center> ><col align=center> ><col align=center> > >and it has no known drawbacks (when used to complement the CSS way, not >instead of it). > >But there's quite challenge on the page mentioned. The fourth column >contains numbers with one or two digits. I don't think centering is desirable >here, as numbers should be right-aligned to be easily comparable. (In the 3rd >column, this does not matter, as numbers are all of the x.xx pattern.) So what >should you do if you want the numbers right-aligned with respect to each >other but centered horizontally within the cells? > >In practice, setting text-align: right; padding-right: 2em might work >sufficiently well, but it's really not a clean solution. I cannot figure out an >approach that does not use added markup (or scripting). > >Besides, there's an entry of "10*", i.e. a number with an asterisk after it. >Normal typography rules say that the expression should be positioned so >that the "0" aligns with the last digit of other integers in the column. Thus >is >something we cannot do any direct way in CSS. Notations like "10*" just don't >fit into the simple models. (Making the number a link instead would be a >more "www-like" approach, but it would not work on paper.) > >(The trickery that crept into my mind is based on left-padding the numbers to >the same width using FIGURE SPACE   for padding, and centering the >cells with a suitable left padding. It works under favorable conditions but >depends on font issues.) > >Yucca >____________________________________________________________________ >__ >css-discuss [[email protected]] http://www.css- >discuss.org/mailman/listinfo/css-d >List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css- >discuss.org/policies.html >Supported by evolt.org -- http://www.evolt.org/help_support_evolt/ ______________________________________________________________________ css-discuss [[email protected]] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
