2016-11-27 181 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

不要以为你需要跨度,你可以通过使用等简化它。 –

相关问题