Hi Greg,

 

A while back, I started going through what you seem to be going through in
relation to CSS. Watching the sessions on CSS at Pluralsight was really
worthwhile. It was a really good investment of my time.

 

I particularly liked the sessions by K.Scott Allen. (There's a reason he's
listed as their first instructor to hit $1.8M USD in income from
Pluralsight. He's good at what he does).

 

Regards,

 

Greg

 

Dr Greg Low

 

1300SQLSQL (1300 775 775) office | +61 419201410 mobile│ +61 3 8676 4913 fax


SQL Down Under | Web:  <http://www.sqldownunder.com/> www.sqldownunder.com

 

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com]
On Behalf Of Greg Keogh
Sent: Sunday, 14 July 2013 9:49 AM
To: ozDotNet
Subject: Fwd: [OT] css and table columns (answer!)

 

I think I've found the answer. I found this nice summary of CSS Selectors
<http://www.w3schools.com/cssref/css_selectors.asp>  and near the end is
:nth-child(n). I ran a few experiments and found this will turn the 2nd
column of all tables yellow:

 

td:nth-child(2) { background: yellow; }

The problem is I have many tables on the page, so I had to apply that
selector to specific tables. After many experiments I eventually found that
if you give a unique id= to each table then you can do this:

 

#table1 td:nth-child(2)

 

However, this worked in my simple test html page but did nothing when I
tried it in a real ASP.NET <http://ASP.NET>  generated page. So after more
bumbling I found that if each table has a unique class= assigned to it then
you can:

 

.footable td:nth-child(2)

 

So this lets me "externally" apply formatting to each column of different
tables without the need to touch the table markup. This can reduce the size
of pages considerably.

 

Greg

Reply via email to