これは私のHTMLです:
<!DOCTYPE html>
<html>
<style>span {text-decoration: none}</style>
<body>
<a href="#">underscored text <span>without underscore</span></a>
</body></html>
<span>
残りは強調されています。可能な回避策は何ですか (JavaScript を使用せず、HTML を変更せずに)?
これを試して
<!DOCTYPE html>
<html>
<style>span {text-decoration: none;display: inline-block;}</style>
<body>
<a href="#">underscored text <span>without underscore</span></a>
</body></html>
元の回答へのリンク: https://stackoverflow.com/a/10478962/662250
アンカータグには下線がないように設定しますが、スパンには下線があります
<a href="#"><span>underscored text</span> without underscore</a>
a{
text-decoration:none;
}
a span{
text-decoration:underline;
}
方法があるとは思わないので、ここに汚いハックがあります:
<html>
<style>
span {border-bottom:1px solid white;}
a {text-decoration: none;border-bottom:1px solid blue;}
</style>
<body>
<a href="#">underscored text <span>without underscore</span></a>
</body></html>
... HTMLを変更できないと言ったからです。