i use this code to color my links and it works fine A:link { COLOR: #ffffff; TEXT-DECORATION: none } A:visited { COLOR: #ffffff; TEXT-DECORATION: none } A:active { COLOR: #ffffff; TEXT-DECORATION: none } A:hover { COLOR: #cccccc; TEXT-DECORATION: none } the problem is that i have some links that i want to be gray and others that i want to be yellow. How do I solve this problem? thanks in advance.
set up a separate class like this! a.classYellow:link { color: yellow; } a.classYellow:visited { color: yellow; } Then assign the class to your link like this: <a href="#" class="classYellow">Look, A Yellow Link!!!!</a> Hope this helps
thanks but how come the text size won't work when i do this a.classYellow:visited { color: yellow; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.yellow { font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFF00; font-size: 11px; } .yellow a:link { color: #FFFF00; text-decoration: none; } .yellow a:visited { color: #FFFF00; text-decoration: none; } .yellow a:hover { color: #FFFF00; text-decoration: underline; } Code (markup): You have to mention class in your url, ex: <a class="yellow" href="htp://">Yellow Link</a>
generally, you will want to class a wrapper of the anchor, not the anchor itself (for a more cross-browser solution) So if you had it in a ul/li you would do <ul class="nav"> <li class="home"><a href="/">Home</a></li> <li class="contact"><a href="/contact/"></li> </ul> now you can do: ul.nav li.home a:link, ul.nav li.home a:visited, ul.nav li.home a:active { color:red; } ul.nav li.home a:hover { color:green; text-decoration:none; }
which browsers dont work with the first way? I have been doing it that way for years while using ie5, then ie6, then firefox, safari, and a few based off those like camino and shiira. They all work for me.
I remember seeing issues with this method in some browser, maybe IE4 or NS4? a.classYellow:link { where it can't detect the psuedo and class...
oh I see. That makes sense then why I have never had those problems. I think it's safe to say however, that most people are using ie6 or above. As well as newer versions of ns4. Either way, it's only a little loss of color