[英]HTML default link color
I want to set color of some elements to default link color with CSS. 我想用CSS将一些元素的颜色设置为默认链接颜色。
<a href="/">That color</a> is the same as <span style="color: link;">that</span>.
Any way to do that? 有办法吗? This website don't change default browser's link color.
本网站不会更改默认浏览器的链接颜色。
Even if you don't change the default color, it would still be a good idea to specify the color to ensure that it looks the same in all browsers. 即使您不更改默认颜色,指定颜色仍然是一个好主意,以确保它在所有浏览器中看起来都相同。 I'd put something like this in the stylesheet:
我在样式表中放了这样的东西:
a, span.link {
color: blue;
}
a:visited, span.visited {
color: purple;
}
a:active, span.active {
color: red;
}
Then you can style span
s as links by <span class="link">Your fake link</span>
然后,您可以通过
<span class="link">Your fake link</span>
来设置span
s作为链接
经过一段时间搞乱测试纯css和css / javascript我确定你不能将任何其他元素的颜色设置为浏览器的默认链接颜色 - 但是像机器说的那样,你可以尝试使用类来做这个(但你不能使用浏览器默认值,你必须设置自己的颜色)
如果要为链接设置新颜色或在访问后阻止更改特定链接的颜色,请在<a>
标记内添加:
<A STYLE="text-decoration:none; color=[select your favorite...]" HREF="link.html">test link</A>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.