2017-02-19 34 views
0

我想這樣做,以便當鼠標懸停在我的超鏈接上時,它會改變顏色。現在它仍然是黑色的,所以很難看到文本是超鏈接。在HTML中懸停超鏈接的顏色

下面是HTML代碼:

 
&lth4 style="text-align: left;">&lta href="hyperlink" target="_blank">&ltspan style="color: #000000;">The making of #bobthebrewbus</span></a></h4> 

回答

0

您可以添加以下CSS:

h4 a:hover span { 
    color: red !important; // Change the color to your preference. 
} 

:hover導遊當錨徘徊時會發生什麼。我添加了!important,以便它可以覆蓋span元素中的內聯css。如果將內聯CSS移動到外部CSS,則可能不需要!important聲明。

+0

我工作的一個WordPress站點和翻轉到文本編輯所以它只是在HTML中。我可以更改爲CSS或如何將其轉換爲HTML並添加到代碼中? –

+0

您需要在文檔中的樣式標籤中編寫CSS。僞類(如:hover)永遠不會引用元素,而是引用滿足樣式表規則條件的任何元素。 – ankitjain11

0

<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>

0

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>