Chris Ovenden wrote:
> 3) is actually impossible, as there is no element (<tc> or something) to
> identify a column in HTML.

In HTML, <colgroup> and <col> elements identify columns. It's just that 
they are useless to CSS because they are abstract - in terms of document 
structure they do not actually contain the groups of elements they 
represent, so giving a <col> element a width won't achieve anything 
because the <td>s aren't in there. The best and worst thing about tables 
is that they're 2 dimensional - as far as linear XML and CSS are 
concerned, there is only 1 dimension, and table cells are elements 
contained by their table row; you can't have two same-level containers.

> which leaves...
> 
> 2) which as far as I see it is best practise. It gives a clear mening to the
> cell, however it may end up getting displayed. What is your objection to
> writing td.stock_price_col { width:77px } ?

This is a tough one - we're bumping into the monolith issue of semantic 
CSS again. stock_price_col sounds like an id property to me, seeing as 
it denotes a specific object - if you wanted to use the same rule on 
another object, the name will no longer hold, you'd be wanting another 
class - and then it becomes clear that thoses classes should be ids.

But you don't want ids for stock prices, you want a class which is 
'fixed width column', which is not primarily associated with stock 
prices, but with columns that are better off with a specific width 
attribute. The problem is that, according to the rules of semantic CSS, 
you can't name a class or id based on the rules you will use them to 
apply - it has to be unrelated to the presentation they will be used 
for, and more indicative of the the structural semantic reason you're 
giving the style. As it is, their probably is none. My advice is 
.fixedwidthcolumn, even though it breaks those rules. It still makes far 
more sense.

People often use the phrase 'CSS vs tables', which is a poorly conveyed 
way of saying DIVs should be used instead of table cells for layout 
information that isn't cross-reference data. The way they say it implies 
that if you're using high-grade, standardised CSS you can't use tables 
effectively, and vice-versa. The sad thing is they'd be right.

Regards,
Barney
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
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/

Reply via email to