Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS: Change font color based on current color

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.

like image 657
Jggrnaut Avatar asked Dec 19 '12 20:12

Jggrnaut


1 Answers

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

http://jsfiddle.net/3zLfb/

like image 188
MikeTedeschi Avatar answered Oct 30 '22 01:10

MikeTedeschi