CSS 链接颜色不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7318612/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CSS link color not working
提问by jasper bloom
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.
我正在尝试更改我的选项卡按钮之一的链接颜色,但它不起作用。这很奇怪,因为同一大括号下的所有其他属性都可以正常工作,但该属性clor:#FFFAFA
不起作用。我已将其设置为#778899
背景,以便可以看到前者的雪白色。
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>
回答by Hans Wassink
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;
}
回答by Madhur Ahuja
It might be because the links are visited.
可能是因为访问了链接。
http://www.w3schools.com/css/css_link.asp
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 */
回答by adarshr
Works for me - http://jsfiddle.net/ZS2Vn/
对我有用- 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;
color: #EFEAEA;
或者 color: #DFDADA;
And of course, like others have answered, you should have pseudo selectors for visited, active and hover as well.
当然,就像其他人回答的那样,你也应该有用于访问、活动和悬停的伪选择器。
回答by Jasser
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.
这是因为您打开的链接在浏览器中存储为已访问。删除您的历史记录或您正在使用的历史记录页面的链接将完成您的工作。尝试一下。这就是解决方案。