This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes CSS:  specifiying the link (incl hover, visited) colors for a class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "CSS:  specifiying the link (incl hover, visited) colors for a class" Watch "CSS:  specifiying the link (incl hover, visited) colors for a class" New topic
Author

CSS: specifiying the link (incl hover, visited) colors for a class

Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
I've got a class in a stylesheet:
.allwhitetxt link {text-decoration: none; color: white;}
{
COLOR: #FFFFFF;
FONT-FAMILY: Arial, Verdana, Helvetica, sans-serif;
FONT-SIZE: 11pt;
FONT-WEIGHT: bold;
}
And I'm trying to put the following right after it to specify the link colors for this class b/c I don't know of any other way to do it:
.allwhitetxt:link {text-decoration: none; color: white;}
.allwhitetxt:visited {text-decoration: none; color: white;}
.allwhitetxt:hover {text-decoration: none; color: blue; background-color: white;}
However, this does not seem to be working. Any ideas? I got the above from here:
http://www.microbion.co.uk/web/pseudosel.htm
I also managed to successfully set the general hyperlink colors with this:
A:link {text-decoration: underline; color: blue;}
A:visited {text-decoration: underline; color: purple; }
A:hover {text-decoration: underline; color: white;}
Chris Baron
Ranch Hand

Joined: Mar 21, 2003
Posts: 1049
Hi,
delete this:

the rest is ok. In ie6 it works with the above though...
Did you name the class in the link-tag without the dot?
<a href="#" class="allwhitetxt">
With the dot it doesn't work

cb
[ September 12, 2003: Message edited by: Chris Baron ]
Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
I finally figured out how to change the link (including hover, active, and visited) colors in a CSS stylesheet for only a particular class rather than for all my links in general:
.focusnav
{
COLOR: #FFFFFF;
FONT-FAMILY: Arial, Verdana, Helvetica, sans-serif;
FONT-SIZE: 11pt;
FONT-WEIGHT: bold;
}
.focusnav a:link {text-decoration: none; color: white;}
.focusnav a:visited {text-decoration: none; color: white;}
.focusnav a:hover {text-decoration: none; color: blue; background-color: white;}
.focusnav a:active {text-decoration: none; color: red; background-color: white;}
Oh yeah, and I spelled everything out so much in my first sentence to make sure there would be enough keywords for people who search this forum to find this post!
 
GeeCON Prague 2014
 
subject: CSS: specifiying the link (incl hover, visited) colors for a class