7

I'm trying to find css that will allow me to change the color of text depending on the current color of the text.

Here is the HTML (not HTML5) I'm trying to change:

    <a href="link"><font color="green">2</font></a>
    <a href="link"><font color="red">3</font></a>
    <a href="link"><font color="red">2</font></a>
    <a href="link"><font color="green">3</font></a>
    <a href="link"><font color="red">2</font></a>
    <a href="link"><font color="green">3</font></a>

What I want to do is change to red links to yellow and the green links to blue. I can't use javascript or change the HTML code. I'm only allowed to add CSS to change styles. Is there a way to do this using only CSS.

arttronics
  • 9,957
  • 2
  • 26
  • 62
dlshriver
  • 156
  • 1
  • 15

1 Answers1

17
a font[color="red"] { color: yellow; }
a font[color="green"] { color: blue; }

http://jsfiddle.net/3zLfb/

MikeTedeschi
  • 583
  • 3
  • 7
  • 1
    I don't understand why this got downvoted to begin with. The question was "without changing the html". So even if the font tag is deprecated this shouldn't have been downvoted (of course it is noteworthy that font is deprecated) – Peter Rasmussen Dec 19 '12 at 20:41
  • Thanks for the answer, I tried something similar to this, but I wasn't sure exactly how to do it and I was having a hard time finding it. – dlshriver Dec 20 '12 at 17:06