如何使用css在同一页面上制作不同颜色的链接?

问题描述 投票:0回答:1

我不知道应该使用什么CSS代码来制作它们,我能找到的唯一另一个与Class1和Class2有关,但我什至不知道如何将它们实现到链接上。如果有帮助的话,我也会通过 WordPress 上的图标列表小部件来完成此操作。如果您知道我做错了什么,请提前致谢。我认为这与没有以某种方式标记链接有关

a.class1 {color:red;}
a.class1:link  {text-decoration: none; color: red;}
a.class1:visited {text-decoration: none; color: red;}
a.class1:hover {text-decoration: underline; color: red;}
a.class1:active {text-decoration: none; color: red;}


a.class2 {color:blue;}
a.class2:link {text-decoration: none; color: blue;}
a.class2:visited {text-decoration: none; color: blue;}
a.class2:hover {text-decoration: underline; color: blue;}
a.class2:active {text-decoration: none; color: blue;}
css wordpress colors hyperlink
1个回答
0
投票

在 WordPress 中,您可以向主题添加自定义 CSS 来实现此目的。如果您使用默认的 WordPress 文本小部件,您可以像这样添加链接:

<a href="#" class="class1">Link 1</a>
<a href="#" class="class2">Link 2</a>

将“#”替换为实际的 URL。这样,您的链接将继承您在 CSS 中为 class1 和 class2 定义的样式。

© www.soinside.com 2019 - 2024. All rights reserved.