开发者

CSS link color not working

开发者 https://www.devze.com 2023-04-03 11:48 出处:网络
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 bra开发者_StackOverflow中文版ces are working just f

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 bra开发者_StackOverflow中文版ces 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>


Well this should be working, but it is probably overwritten by your browser with a default "visited" link color. Change your CSS to:

a, a:link, a:visited {
  color: #FFFAFA;
  text-decoration: none;
  background-color: #778899;
}


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 */


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.


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.


I think the problem occurs because you are missing a semicolon on the background-color line.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号