在以下示例中,我使用字体为我的导航创建图标:
http://www.blackcountrydesigns.co.uk/examples/green/
http://www.blackcountrydesigns.co.uk/examples/green/
我遇到的问题是,当您将鼠标悬停在链接上时,您会在链接和图标上显示下划线.
这是我的代码:
HTML <ul class="hidden-phone"> <li><a class="entypo-home" href="#">Home</a></li> <li><a class="entypo-briefcase" href="#">Services</a></li> <li><a class="entypo-picture" href="#">Portfolio</a></li> <li><a class="entypo-address" href="#">Contact</a></li> </ul> CSS #nav ul li a {color:#ccc; margin-left: 25px;} #nav [class*='entypo-'].active:before {color:#666;} #nav [class*='entypo-']:before {font-size: 46px; position: relative; top: 5px;left: -3px; color:#999;} [class*='entypo-']:hover:before {text-decoration:none !important;}
非常感谢
解决方法
我发现,从生成的内容中删除(通常)继承的样式的唯一方法是使用简化的演示(来自注释)给它位置:绝对:
a:link { text-decoration: none; position: relative; margin-left: 1em; } a:hover { text-decoration: underline; } a:before { content: '#'; position: absolute; right: 100%; top: 0; bottom: 0; width: 1em; }