我想确保链接以不同的颜色显示,即使我为包含它们的文本着色也是如此。现在我的链接显示为不同的颜色,但只有当文本没有颜色时才会显示。如果页面上的文本是彩色的,当我将鼠标悬停在它们上面时,我只会看到不同颜色的下划线。我想让人们知道那里有链接。谢谢!
最佳答案
欢迎使用 Stackoverflow!您可以使用 a:
指定各种状态下的链接样式。 CSS 中的选择器。链接样式不会受到 CSS 中任何其他样式规则的影响,除非您定义更具体的规则(例如 p a:link
,这会影响 <p>
标签内的所有链接。请参阅代码和链接如下:
HTML:
<p>
Text,text,text,goose <a href="#">Link</a>
<p>
CSS:
p{
color:blue; /*Colors the paragraph text blue.*/
}
a:link{
color:black; /*This will make the default color of your link black.*/
}
a:hover{
color:green; /*When a mouse hovers over the link it will turn green.*/
}
a:active{
color:red; /*This will cause the link to turn red when it is clicked.*/
}
a:visited{
color:orange; /*This will specify the color of the link after it has been visited.*/
}
关于css - 即使文本是彩色的,如何确保链接颜色也被强制执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21770259/