1

How can I remove the underline in a subscript text enclosed in the <u> tag with CSS?

This doesn't work.

u sub {
  text-decoration: none;
}
<u>The text should be underlined,<sub>but not the subscript</sub></u>
Stickers
  • 75,527
  • 23
  • 147
  • 186
SlumpA
  • 882
  • 12
  • 24

1 Answers1

9

You can set sub to display: inline-block;

u sub {
  display: inline-block;
}
<u>The text should be underlined,<sub>but not the subscript</sub></u>
Stickers
  • 75,527
  • 23
  • 147
  • 186