news.internode.on.net <ke**********@hotmail.comscripsit:
Is there any way that a STYLE attribute can be used to control the
color of hyperlinks.
Not the way you want. Note that your Subject line contains a question that
you don't actually ask in the message content. The style="..." attribute,
when set for an <aelement, may affect the link, but you cannot distinguish
between active, hover, etc. states that way - you need a <styleelement or
an external style sheet.
We have a tabular output generator written in C#. Each column of the
table is defined by a column, and each column can have what is called
a "styler". The styler is evaluated once for each cell, for every row
emitted.
Make the generator emit class="..." attributes and use classes in CSS.
However, consider first the principle "don't mess around with link colors;
they are as they are for a reason". (See
http://www.cs.tut.fi/~jkorpela/www/links.html for a detailed explanation.)
This all works fine, but a standard STYLE="color: red" attribute does
not affect the color of a hyperlink, and sometimes the tabular output
will contain some hyperlink columns.
If you set the color of a cell, that won't affect the colors of the elements
inside the cell unless they inherit the color from the enclosing element.
And links won't, since they have their colors set in the browser style sheet
(at least). To set link color, you would have to set color for the <a>
element (or for a pseudo-element like :link that matches a <aelement in
one of its states).
Can this be done, or is CSS the only option?
You _are_ trying to use CSS, just the wrong way. The content of the
style="..." attribute is CSS.
If problems remain, I'd suggest asking for further clarifications in
c.i.w.a.stylesheets, the CSS group, and including the URL of a demo page to
illustrate what you are really doing.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/