4

これは私の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 を変更せずに)?

4

3 に答える 3

4

これを試して

<!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

働くフィドル

于 2012-11-18T17:38:07.700 に答える
1

アンカータグには下線がないように設定しますが、スパンには下線があります

<a href="#"><span>underscored text</span> without underscore</a>

a{
  text-decoration:none;
}

a span{
  text-decoration:underline;
}
于 2012-11-18T17:31:29.673 に答える
0

方法があるとは思わないので、ここに汚いハックがあります:

<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を変更できないと言ったからです。

于 2012-11-18T17:41:23.350 に答える