2016-11-27 209 views
0

請參閱我的項目:http://www.livingthelighterlife.com/如何更改:before元素上的懸停背景顏色?

試圖讓社交媒體部分的懸停背景色工作。圖標通過:before標籤出現。我嘗試添加:之前:懸停,但它不工作。

此外:我似乎無法弄清楚爲什麼每個之間都出現破折號。請幫助解決這個問題!

任何幫助,將不勝感激!

[class^="icon-"]:before, [class*=" icon-"]:before { 
 
\t display: inline-block; 
 
\t line-height: 1em; 
 
\t width: 1em; 
 
\t font-family: "fontello"; 
 
\t font-size: 20px; 
 
\t color: #ffffff; 
 
\t font-weight: normal; 
 
\t text-align: center; 
 

 
\t padding: 5px; 
 
\t padding-left: 6px; 
 
\t border-radius: 50%; 
 
} 
 

 
.icon-rss:before, .icon-pinterest:before, .icon-twitter:before { 
 
\t background: #4a4947; 
 
} 
 

 
.icon-rss:before:hover, .icon-pinterest:before:hover, .icon-twitter:before:hover { 
 
\t background: #f15c58 !important; 
 
} 
 

 
.icon-facebook:before, .icon-instagram:before, .icon-heart:before { 
 
\t background: #f15c58; 
 
} 
 

 
.icon-facebook:before:hover, .icon-instagram:before:hover, .icon-heart:before:hover { 
 
\t background: #4a4947; 
 
} 
 

 
.icon-rss:before { content: '\e801'; } /* '' */ 
 
.icon-facebook:before { content: '\f30c'; } /* '' */ 
 
.icon-pinterest:before { content: '\f312'; } /* '' */ 
 
.icon-instagram:before { content: '\f32d'; } /* '' */ 
 
.icon-twitter:before { content: '\f309'; } /* '' */ 
 
.icon-heart:before { content: '\e802'; } /* '' */
<span class="icon-rss"></span> 
 
</a> 
 

 
&nbsp; 
 

 
<a target="new" href="#"> 
 
<span class="icon-facebook"></span> 
 
</a> 
 

 
&nbsp; 
 

 
<a target="new" href="#"> 
 
<span class="icon-pinterest"></span> 
 
</a> 
 

 
&nbsp; 
 

 
<a target="new" href="#"> 
 
<span class="icon-instagram"></span> 
 
</a> 
 

 
&nbsp; 
 

 
<a target="new" href="#"> 
 
<span class="icon-twitter"></span> 
 
</a> 
 

 
&nbsp; 
 

 
<a target="new" href="#"> 
 
<span class="icon-heart"></span>

回答

0

它周圍的其他方法:.icon-rss:hover:before並刪除破折號添加text-decoration: nonea標籤。

編輯:或者,在您的設置中,您還可以嘗試a:hover span更改span的背景顏色。

+0

哪個標籤添加文字修飾:無? – Samantha

+0

a標籤:a {text-decoration:none; } –

+0

不要以爲你需要跨度,你可以通過使用等簡化它。 –

相關問題