Harlan said:
You mean, is there a way to specify for, say, an H2, "Randomly color
each of the letters a different rainbow color so that no two adjoining
letters are the same color?" No.
Right, no, but that's a rather funny interpretation of the question.
If you must have the letters in
assorted colors, you'll have to put each letter in its own span tags
and apply separate colors to those spans.
Using <span style="color:red">x</span> has really no tangible benefit over
<font color="red">x</font>. The same applies to <span class="red">x</span>
with .red { color: red }. You might win something, theoretically at least,
by using something like
<span class="special">x</span>
inside an h2 and
h2 .special { color: red; background: white; }
There *is* a :first-letter pseudo-element you can use to style the
*first* letter in an element differently from the remaining letters:
h2 { color: red; }
h2:first-letter { color: green; }
It's of course just an example, but a manifestly poor example: it sets color
without background, and it tries to make a color distinction but is
guaranteed to fail (more or less) for people with the most common form of
color-blindness.
I don't know what cross-browser support for :first-letter is.
Fairly good, see
http://www.quirksmode.org/css/contents.html
which tells that support exists at least from IE 5.5, which is probably the
oldest browsers worth caring about in matters of visual representation.
Of course, other usual CSS caveats still apply, so I would not recommend
using CSS e.g. to generate a logo that contains colored letters. An image is
a more practical approach. But if it's just fun coloring, go ahead.
Yucca