[WEB4LIB] CSS behavior ? Answered

Andrew Mutch amutch at waterford.lib.mi.us
Thu Mar 8 13:10:19 EST 2001


As I expected, I had a quick response that sorted out the problem for me.

Thomas Dowling asked:

"a:hover comes before a:visited in your stylesheet, right?"

Which was the case.

He then noted:

"I believe that a:visited and a:hover have the same specificity for the A
element in the cascade.  That should mean that whichever is definied
*last* in the stylesheet would take precedence when an anchor is both
visited and being hovered over.  Since the a:visited style doesn't specify
a background, that passes down the cascade from the earlier definition at
a:hover."

So, I rearranged the order of the a:hover and a:visited and Voila! It works just
the way I wanted.

Thanks again to Thomas for his quick assistance!

Andrew Mutch
Library Systems Technician
Waterford Township Public Library
Waterford, MI

Andrew Mutch wrote:

> I've set up a style sheet where I would like the color of the text and the
> background to change when the mouse hovers over a link.  So, I added the
> following:
>
> a:hover {text-decoration: none; color: 900; background: FC6;}
>
> Now, this works as expected when the mouse moves over a link that has not been
> "visited".  However, when the link is a "visited" link, only the background
> color changes.  The text color of the link does not change.  I've defined a
> visited link as follows:
>
> a:visited {color: 00C;}}
>
> This is in Internet Explorer 5.5  Can anyone explain why it behaves this way
> where the hover property is only recognized by unvisited links?
>
> Thanks in advance!
>
> Andrew Mutch
> Library Systems Technician
> Waterford Township Public Library
> Waterford, MI



More information about the Web4lib mailing list