2016-10-06 140 views
1

我有一個類包含跨班和我的favicon。懸停時,我想同時更改按鈕和圖標的顏色。如何實現?更改顏色的按鈕和我上課懸停

這裏是我的代碼示例:

CSS

a.btn.btn-seeinfo:hover .fa-chevron-right{ 
    color: #597692; 
    background-color: transparent; 
} 

HTML

<a class="btn btn-seeinfo"> 
    <span>"See info"</span> 
    <i class="fa fa-chevron-right"></i> 
</a> 
+0

[看起來工作(HTTP:// jsfiddle.net/JfGV E/1581 /) – Vucko

+0

@ Vucko雪佛龍顏色變化,但文字不變 –

回答

1

<!DOCTYPE html> 
 
<html> 
 
<head> 
 
<title>Font Awesome Icons</title> 
 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
 
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css"> 
 
<style> 
 
.btn-seeinfo:hover { 
 
    color: red; 
 
    background-color: transparent; 
 
cursor:pointer; 
 
} 
 
</style> 
 
</head> 
 
<body> 
 

 

 
<a class="btn btn-seeinfo"> 
 
    <span>"See info"</span> 
 
    <i class="fa fa-chevron-right"></i> 
 
</a> 
 

 

 
</body> 
 
</html>