defining CSS rules for anchors - how

admin

Administrator
Staff member
Hello

I have defined the following rules for anchors:

a:link {
color: green;
text-decoration: none;
text-transform: none;
list-style-type: disc;
font-family: Arial;
font-size: 12px;
}

a:hover {
color: blue;
text-decoration: underline;
text-transform: none;
list-style-type: disc;
font-family: Arial;
font-size: 12px;
}

a:visited {
color: orange;
text-decoration: none;
text-transform: none;
list-style-type: disc;
font-family: Arial;
font-size: 12px;
}

a:active {
color: red;
text-decoration: none;
text-transform: none;
list-style-type: disc;
font-family: Arial;
font-size: 12px;
}

I have 2 links in the site:

<a href=http://www.webdeveloper.com/forum/archive/index.php/"1.html">1</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript: void test();">Test</a>

The first link obeys the rules defined above
The second link doesn't obey the hover rule for some reason.
My only guess is that triggering JavaScript code from links may cause this problem.
I am testing this on IE6
On Mozilla and Opera both links work fine

I would appreciate any helpTry changing the order of your CSS. Remember, CSS are cascading stylesheets, so whatever code comes next overrides whatever code came before it, even if it is already defined.


a:visited {
color: orange;
text-decoration: none;
text-transform: none;
list-style-type: disc;
font-family: Arial;
font-size: 12px;
}

a:active {
color: red;
text-decoration: none;
text-transform: none;
list-style-type: disc;
font-family: Arial;
font-size: 12px;
}

a:link {
color: green;
text-decoration: none;
text-transform: none;
list-style-type: disc;
font-family: Arial;
font-size: 12px;
}

a:hover {
color: blue;
text-decoration: underline;
text-transform: none;
list-style-type: disc;
font-family: Arial;
font-size: 12px;
}thanks
that solved the problemHappy to help.Isn't the order supposed to be
:link
:visited
:hover
:activeOriginally posted by Paul Jr
Isn't the order supposed to be
:link
:visited
:hover
:active

Depends if you want it to change color when you hover over it, even if it's active. With your code, if I click and hold, then move my mouse and release, the link will be the color of :active -- even when I put my mouse over it again. Often, I prefer it the other way around, although I don't use the "active" pseudo-class often enough to care anyway.
 
Back
Top