gpt4 book ai didi

html - html 中的链接 - 颜色

转载 作者:太空宇宙 更新时间:2023-11-04 00:28:23 24 4
gpt4 key购买 nike

我的代码里有这个

a:link {text-decoration: none; color: black;}
a:visited {text-decoration: none; color: black}
a:active {text-decoration: none; color: black}
a:hover {text-decoration: underline; color: grey;}

但现在我需要在同一页面中,但在另一个本地,颜色会更改为另一个

例如,标题中的链接颜色为白色,按钮中的颜色为黑色。

我不能简单地重复上面的代码。

我该如何解决?

最佳答案

您可以为标题链接分配一个类:

<a class="header" href="yourpage.html">Header Link</a>

然后在你的 CSS 中:

a.header:link {text-decoration: none; color: black;}
a.header:visited {text-decoration: none; color: black}
a.header:active {text-decoration: none; color: black}
a.header:hover {text-decoration: underline; color: grey;}

对于非标题链接:

<a href="link.html">Normal Link</a>

然后对于 CSS 中的普通链接:

a:link {text-decoration: brown; color: black;}
a:visited {text-decoration: none; color: black}
a:active {text-decoration: none; color: black}
a:hover {text-decoration: underline; color: grey;}

关于html - html 中的链接 - 颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5494030/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com