在href中停止跨越href从href继承悬停样式

Jam*_*ber 0 html css

问题

我需要跨度来没有text-decoration: underline.无论如何我都无法改变标记.这可能吗?

标记

<a href="#">
    Working test
    <span>?</span>
</a>
Run Code Online (Sandbox Code Playgroud)

CSS

a:hover {
    text-decoration: underline;
}

a:hover span {
    text-decoration: none;
}
Run Code Online (Sandbox Code Playgroud)

j08*_*691 5

试试这个jsFiddle示例.适用于所有现代浏览器和IE8 +.

a {
    text-decoration:none;
    position:relative;
    padding-right:16px;
}
a:hover {
    text-decoration: underline;
}
span {
    text-decoration: none;
    position:absolute;
    right:0;
}
Run Code Online (Sandbox Code Playgroud)