[thelist] Changing Link Colors In Site

S.tygian B.lacksmith S.tudios studio at zero.zero.xs2.net
Wed Oct 16 20:27:01 CDT 2002

JP> "If I have a table layout with 3 columns and want my link colors to
be a certain color in one column and a different color in the other two,
how and where do I specify them?"

The easiest way to do this is to use class attributes and contextual
selectors. What I mean is that you can assign classes to each of your
columns like this:

<td class="col1">foo</td>
<td class="col2">bar</td>
<td class="col3">baz</td>

And then specify that anchor elements in td elements with certain
classes have certain colors by adding something like this to your

td.col1 a {
     color: rgb(255, 128, 128);
td.col2 a {
     color: Red;

Etc. Of course, this is just a basic example and doesn't touch on using
pseudo-classes like a:link and a:active, but the principle stays the
same. You can omit the "td" part of the rule if you're not going to be
using those class names on any other elements.

This isn't the most effective way to do it - there are selectors for the
first child element and so on which would make it unnecessary to use the
class selectors - but they're not widely supported yet.

S. G. Kearn

More information about the thelist mailing list