1) is not really a good idea, as it doesn't separate markup from styling.
What if in a later incarantion, the width of the column is to be changed?
You'd end up with some css which reads td.w77px { width:100px } or whatever.
How confusing is that? It's as bad as having a class called 'orange'; you
might as well use an inline style for all the separation that gives you.

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

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 } ?

Chris

On 1/23/07, james shannon <[EMAIL PROTECTED]> wrote:
>
> Hi...
>     I hope I'm not going to start/rehash an argument, but I'm looking
> for the best practice for one-off css values.
>
>     For example, I have a table of data and I want a specific column
> to be 77px wide. I don't really like the style="width: 77px" inside a
> <td>, because I'm not separating the presentation from the display.
>
>     So that leaves several options:
> 1. The most re-usable would be give it a class - w77px -- and give
> that class the width:77px. That way when I have a div, on another
> page, that I also want to be 75px wide, I can assign that class. I
> can also have a class, maybe -- rtl -- that sets the text direction.
> This way I can do class="w77px rtl" or class="w120px rtl". This seems
> the most straightforward, but not "correct".
>
> So that leaves:
>
> 2. A specific class, or a specific selector -- table
> td.stock_price_col -- that I assign the values to.
> 3. Assigning to an id that I give that column -- #stock_price_col.
>
> It seems to me that #1 is the easiest, because I can just start
> assigning a bunch of classes to an element based on what I want it to
> do, but that #2 makes the most sense from the perspective of what CSS
> should be.
>
> However, it seems that a lot of people use IDs rather than class
> names (<div id="footer"> rather than <div class="footer">), so I'm
> not really sure (except that id= implies there will never be more
> than one per page)....
>


-- 
Chris Ovenden

http://frontend.blogsome.com
______________________________________________________________________
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