我想这样做,以便当鼠标悬停在我的超链接上时,它会改变颜色。现在它仍然是黑色的,所以很难看到文本是超链接。在HTML中悬停超链接的颜色
下面是HTML代码:
<h4 style="text-align: left;"><a href="hyperlink" target="_blank"><span style="color: #000000;">The making of #bobthebrewbus</span></a></h4>
我想这样做,以便当鼠标悬停在我的超链接上时,它会改变颜色。现在它仍然是黑色的,所以很难看到文本是超链接。在HTML中悬停超链接的颜色
下面是HTML代码:
<h4 style="text-align: left;"><a href="hyperlink" target="_blank"><span style="color: #000000;">The making of #bobthebrewbus</span></a></h4>
您可以添加以下CSS:
h4 a:hover span {
color: red !important; // Change the color to your preference.
}
的:hover
导游当锚徘徊时会发生什么。我添加了!important
,以便它可以覆盖span
元素中的内联css。如果将内联CSS移动到外部CSS,则可能不需要!important
声明。
<style type="text/css">
<!--
a:link {color: #000000; text-decoration: underline; }
a:active {color: #0000ff; text-decoration: underline; }
a:visited {color: #008000; text-decoration: underline; }
a:hover {color: #ff0000; text-decoration: none; }
-->
</style>
a:hover {color: red;}
a { color: black; text-decoration: none;}
<h4 style="text-align: left;"><a href="hyperlink" target="_blank">The making of #bobthebrewbus</a></h4>
我工作的一个WordPress站点和翻转到文本编辑所以它只是在HTML中。我可以更改为CSS或如何将其转换为HTML并添加到代码中? –
您需要在文档中的样式标签中编写CSS。伪类(如:hover)永远不会引用元素,而是引用满足样式表规则条件的任何元素。 – ankitjain11