问题
I am trying to change the link color of one of my tab buttons but its not working. Its strange because all the other attributes under the same curly braces are working just fine but the attribute clor:#FFFAFA is not working. I have set it against a #778899 background so that the former's snow-white color is visible.
Here's the code.
a:link
{
color:#FFFAFA;
text-decoration:none;
background-color:#778899
}
it is always purple and never changes
Here is the code where I implement it
<dl class="profileTab">
<dd class="profileTabContents"><a href="edit.php">Personal Infomration</a></dd>
<dd class="profileTabContents"><a href="education.php">Education, Employment & Activities</a></dd>
<dd class="profileTabContents"><a href="sports.php">Sports & Athletics</a></dd>
<dd class="profileTabContents"><a href="entertainment.php">Entertainment & Attractions</a></dd>
<dd class="profileTabContents"><a href="philoSociety.php">Philosophy & Society</a></dd>
</dl>
回答1:
Well this should be working, but it is probably overwritten by your browser. Make it:
a, a:link, a:visited {
color: #FFFAFA;
text-decoration: none;
background-color: #778899;
}
回答2:
It might be because the links are visited.
http://www.w3schools.com/css/css_link.asp
a:link {color:#FFFAFA;} /* unvisited link */
a:visited {color:#FFFAFA;} /* visited link */
a:hover {color:#FFFAFA;} /* mouse over link */
a:active {color:#FFFAFA;} /* selected link */
回答3:
Works for me - http://jsfiddle.net/ZS2Vn/
That colour is too faint to notice a change from the white background of the page. Try setting a slightly darker foreground colour.
color: #EFEAEA; or color: #DFDADA;
And of course, like others have answered, you should have pseudo selectors for visited, active and hover as well.
回答4:
This is because the link you have opened is stored as visited in the browser. Delete your history or the links of your page with which you are working from the history will do your work. Try it. This is the solution.
来源:https://stackoverflow.com/questions/7318612/css-link-color-not-working