Previous Message
Next Message

aligning data in large tables

Sent by Philippe Wittenbergh on 9 March 2007 11:11


On Mar 9, 2007, at 7:14 PM, Jukka K. Korpela wrote:

> On Fri, 9 Mar 2007, Philippe Wittenbergh wrote:
>
>> td:first-child+td+td+td {text-align:right;} will select the 4th
>> column in good browsers (including IE7).
>> For IE 6, you need to use the col element.
>> <table>
>> 	<colgroup><col><col><col><col class="alignRight"><col><col></ 
>> colgroup>
>>
>> col.alignRight {text-align:right;}
>>
>> Note that you have to put the 2 selectors on separate lines, _not_
>> grouping them, else IE 6 won't recognise anything.
>
> I had some difficulties in understanding the last statement, but  
> then I
> realized that you are warning against combining the two _rules_  
> into one,
>
> td:first-child+td+td+td, col.alignRight {text-align:right;}
Correct. Written like that IE 6 won't apply anything. It considers  
the first part invalid (+ unrecognised) and ignores the whole thing.  
According to CSS 2.1, 4.1.7, IE gets _that_ part of CSS 2.1 correctly.

> Instead of <col class="alignRight">, I think you could just as well  
> use
> the more direct <col align="right">, since that's what you mean, and
> you're doing this only to deal with compatibility issues, using a  
> method
> that works on IE 6 (and other old browsers).

I used a class, because one might eventually add other properties/ 
values.
I _was_ lazy while naming the class, though :p.

PS - in an ideal world I wouldn't use td:first-child+td+td+td, but  
td:nth-child(). Support is a bit weak atm.

Philippe
---
Philippe Wittenbergh
<http://emps.l-c-n.com>




______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: