I have the following HTML
<div style="text-decoration: underline;">
outer text
<div style="text-decoration: none;">inner text</div>
</div>
Even though I used "none" for "inner text", it is still underlined. Here is the JS fiddle example: http://jsfiddle.net/oj2wj1d6/1/
How can I remove the underline from "inner text"? I have to maintain the same HTML structure without adding any new HTML tags.
Remove underlining To remove single underlining from words and spaces, select the underlined text and press Ctrl+U. To remove other styles of underlining, press Ctrl+U twice.
In CSS, we will use text-decoration property to style underline. CSS text-decoration-color Property: This property is used to specify the color of decorations (overlines, underlines, and line-throughs) over the text.
The property text-decoration-line is used to underline the text. This property has three values that are overline, underline, or line-through. So, the value underline is used to underline the text in CSS. This value draws the underline beneath the inline text.
This is actually the defined behavior in the spec:
Text decorations draw across descendant elements. This means that it is not possible to disable on a descendant a text decoration that is specified on one of its ancestors.
More details at https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With