Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for a list of hyperlink properties

Status
Not open for further replies.

OceanDesigner

Programmer
Oct 30, 2003
173
US
I am looking for a list of hyperlink properties that I can use in a style sheet. I know of the a:link, a:hover and a:visited properties. I need another property for hover & visited (something like a:hover-visted). I appreciate the help.

Jeff
 
The only one I know you are missing from your collection is:
Code:
a:active
Could you explain what your problem is and give us a clue how to help?

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
There is no such thing. Since :hover, if used correctly, will take precendence over the :visited value, you could use that to cascade your effect:
Code:
a:link {
  color: blue;
  text-decoration: none;
}

a:visited {
  text-decoration: strikethrough;
}

a:hover {
  color: red;
}
This will have different states for link, hover, visited and visited hover.
 
I have a menubar with a red background, yellow lettering. On hover, the background changes to yellow, and lettering to red. I do not want the properties to change after having visited. Right now, after visiting the background changes to yellow, but the lettering stays yellow. a:active does not seem to do anything. My style sheet reads as follows:

a.yellow:link { color: #FFFF00; background-color: none}
a.yellow:hover {color: #993300; background-color: #FFFF00}
a.yellow:visited { color: #FFFF00; background-color: none}
a.yellow:active {color: #993300; background-color: #FFFF00}
 
Code:
<style type="text/css">
a:link {color: red; background: yellow;}
a:visited {color: red; background: yellow;}
a:hover {color: yellow; background: red; font-weight: bold;}
a:active {color: red; background: yellow;}
</style>
<a href="">test</a>
 
If you want bgcolour none then just don't set anything.

Code:
a:visited {color: red;}
 
In CSS, when not venturing into descendant selectors and ids, the lower (later) line will always take precedence to the former. In your code, that means that once like is visited, hover effect will no longer work. If that is your goal, your code is ok. If not, then you should revise the code so that it uses correct order of pseudo elements:
:link
:visited
:focus
:hover
:active

Of course, if you are not using one of those, you can skip them. You can still check my above example to see how to have links that distinguish between unvisited links, visited links and both in hovering mode.
 
In your code, that means that once like is visited, hover effect will no longer work.
That's not entirely true. Later rules take precedence over earlier ones, but if there are properties that are set in the early rule and not set (or invalid, like [tt]background-color: none[/tt]) in the later one, they'll be carried through.

So in this case the [tt]background-color: #FFFF00[/tt] of the a:hover rule is still applied to visited links. Changing instances of [tt]background-color: none[/tt] to [tt]background-color: transparent[/tt] should do what you want, as would setting the background to the red you're using.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top