HighDots Forums  

Style the first col (all TD) using CSS?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Style the first col (all TD) using CSS? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
howa
 
Posts: n/a

Default Style the first col (all TD) using CSS? - 09-30-2007 , 02:24 AM






Hello, I want to style the first column (i.e. all TD in the first col)
using CSS?

I have tried, e.g.

td:first-child { color: red; }

but not working, any suggestions?

thanks.


Reply With Quote
  #2  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Style the first col (all TD) using CSS? - 09-30-2007 , 06:40 AM






Scripsit howa:

Quote:
Hello, I want to style the first column (i.e. all TD in the first col)
using CSS?
Does that column actually consist of row headers? Then TH markup would be
more logical - and would make the styling easier.

Quote:
I have tried, e.g.

td:first-child { color: red; }

but not working, any suggestions?
Which browser(s) did you test it on? IE 6 and older don't support
:first-child, and even IE 7 doesn't in Quirks Mode. But in any modern
browser, for a document that complies with HTML specifications, it works. Of
course this might not be enough, since IE 6 is still the most popular
browser.

Then what's left is the clumsy way of using <td class="first"> in all the
cells of the column and using a class selector. With any decent web page
editor, modifying the markup is easy, so the clumsiness is only at the
markup level.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #3  
Old   
Sherm Pendley
 
Posts: n/a

Default Re: Style the first col (all TD) using CSS? - 09-30-2007 , 07:03 AM



howa <howachen (AT) gmail (DOT) com> writes:

Quote:
Hello, I want to style the first column (i.e. all TD in the first col)
using CSS?

I have tried, e.g.

td:first-child { color: red; }

but not working, any suggestions?
If you're highlighting it because it's a heading, mark it up as such - use
th instead of td.

Not only is that more semantically appropriate, it also makes it trivial
to make your headings red:

th { color: red; }

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.