将访问的链接颜色设置为未访问链接的颜色(不是通常的问题) [英] Set visited link color to whatever the color of un-visited link is (P.S. not the usual question)

查看:428
本文介绍了将访问的链接颜色设置为未访问链接的颜色(不是通常的问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要设置a:访问CSS为正常a设置为

的颜色。



我想要的



我需要为您的浏览器指定浏览器链接,并使用与未访问的链接相同的颜色



喜欢,如果有些奇怪的浏览器使用绿色作为正常未访问链接的颜色,这个CSS应该指示浏览器对访问的链接使用相同的绿色。浏览器使用什么颜色应该对我的代码透明。因此短语任何颜色。



我知道如何设置:访问和一个特定的颜色。这不是我要的。



P.P.S。我愿意使用JavaScript,如果我有。但我真的很讨厌让浏览器这样做。



为什么我要做一些像你这样的事情?



IE8用于链接的蓝色是很酷的。它不是#0000FF。这是一个很好的蓝色的树荫。所以我想为访问和未访问的链接设置。但我不应该采取截图或使用一些加载项来选择确切的十六进制值每次。如果IE后来更改颜色到一些其他令人敬畏的阴影,这段代码应该工作。我不想再次找到十六进制,并改变我的代码。



这只是一个原因。不要给我那个蓝色的十六进制。发现这很容易,但这不会是答案!

解决方案

 链接{color:inherit} 
a:active {color:inherit}
a:visited {color:inherit}
a:hover {color:inherit}



Hell是。



我需要这个,因为一些文本链接是我项目主菜单的主要部分,所以我想要他们的我的颜色,而不是浏览器颜色!



每个链接都包含在ap标签组中, (MY颜色)在CSS中设置。


I need to set the a:visited CSS to whatever color the normal a is set to.

What I want to be able to tell the browser is, for the visited links, use the same color as the unvisited links, whatever color it is.

I need to do this without specifying a particular color.

Like, if some weird browser comes along that uses "green" as the color for normal unvisited links, this CSS should instruct the browser to use that same green for visited links. Exactly what color is used by the browser should be transparent to my code.. hence the phrase "whatever color".

P.S. I know how to set a:visited and a to a particular color. That is not what I am asking.

P.P.S. I am willing to use JavaScript if I have to. But I am really hellbent on making the browser do this.

Why would I want to do something like that you ask?

The blue color that IE8 uses for links is kind of cool. It is not #0000FF. It is a nice shade of blue. So I want to set it for both visited and unvisited links. But I shouldnt take a screenshot or use some add-on to pick the exact hex value each time. If IE later changes the color to some other awesome shade, this code should just work. I don't want to again find the hex and change it all over my code.

This is just one reason. Don't give me the hex for that blue. Finding that out is easy but that wouldn't be the answer!

解决方案

a:link{color:inherit}
a:active{color:inherit}
a:visited{color:inherit}
a:hover{color:inherit}

Hell yes.

I needed this because some text links (as opposed to image links) were a major part of my project's main menu, so I want them MY colours, not browser colours!

Each link was enclosed in a p tag group whose class had a particular colour (MY colour) set in CSS.

这篇关于将访问的链接颜色设置为未访问链接的颜色(不是通常的问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆