简体   繁体   中英

HTML default link color

I want to set color of some elements to default link color with 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>

经过一段时间搞乱测试纯css和css / javascript我确定你不能将任何其他元素的颜色设置为浏览器的默认链接颜色 - 但是像机器说的那样,你可以尝试使用类来做这个(但你不能使用浏览器默认值,你必须设置自己的颜色)

如果要为链接设置新颜色或访问阻止更改特定链接的颜色,请在<a>标记内添加:

<A STYLE="text-decoration:none; color=[select your favorite...]" HREF="link.html">test link</A>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM