【问题标题】:IE:11 hover on before not working [closed]IE:11悬停在不工作之前[关闭]
【发布时间】:2017-11-08 18:16:31
【问题描述】:

我的链接结构如下:

a{
  // some css here
}
a:before{
 // contains font icon
}
a:hover{
 text-decoration:underline;
}
a:hover:before{
 text-decoration:none;
}

我只需要在链接悬停时添加text-decoration:underline,而不是在前面部分。我的代码在 chrome 上运行良好,但在 IE 11 上,text-decoration:none 不适用于a:hover:before

【问题讨论】:

标签: css css-selectors internet-explorer-11 pseudo-element


【解决方案1】:

你可以把<a>的主要内容放在一个span中,只在span下划线。

a {
  text-decoration:none;
}
a:before {
 content: '➠ ';
}
a:hover span {                 /* changed */
 text-decoration:underline;
}
a:hover:before {
 text-decoration:none;
}
<a href="#"><span>Click here</span></a>

【讨论】:

    猜你喜欢
    • 2016-04-06
    • 2017-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-23
    • 1970-01-01
    • 2012-01-08
    相关资源
    最近更新 更多