How do I get this CSS text-decoration override to work?

前端 未结 6 2292
生来不讨喜
生来不讨喜 2020-11-22 11:49

Some days I swear I\'m going mad. This is one of those days. I thought my CSS was fairly straight-forward here, but it just doesn\'t seem to be working. What am I missing?

6条回答
  •  星月不相逢
    2020-11-22 12:21

    o.k.w.'s answer above explains perfectly why you can't do what you are asking without some other changes. No, you're not going mad!

    Possible workarounds:

    • try border-bottom?
    • wrap the text you want underlined in a span class="u" tag? (to prevent the text-decoration from decorating nested elements)
    • if you aren't able to change the markup, you could add some scripting to accomplish the same as my previous suggestion.

    Best of luck!

提交回复
热议问题