考虑下面的HTML:伪元素悬停和文字修饰
<a href="#"><span data-icon="✪"></span>A Link</a>
是否有可能改变text-decoration
(无人)悬停? color
将改变,text-decoration
不会。
CSS:
a { text-decoration: none; }
a:hover{ text-decoration: underline; }
a:hover [data-icon]:before{
/*Doesn't work*/
text-decoration: none;
/*Works*/
color: red;
}
我没有看到锚红色的工作,这是工作的跨度,文字装饰来自锚点而不是跨度。你正在寻找的最终结果是什么?强调文字而不是图标?要么 ?? – Huangism
@Huangism我不想强调图标上的下划线。 –
你想在A Link文本上加下划线吗? – Huangism