Is it possible to highlight text in an HTML document using without wrapping it with <span>
or any other tag for that matter?
For example, in the HTML code <p>The quick fox</p>
I would like to highlight quick
but without adding a DOM element around it. Adding a DOM element to a parent element is fine.
Thanks!
The <mark> tag defines text that should be marked or highlighted.
How Do I Highlight Text In CSS? To Highlight text in HTML you have to use an inline element such as the <span> element and apply a specific background style on it. This will create the highlighting effect, which you can tweak in many different ways to create different looks.
No, it is not possible.
You can't tell the browser to render a piece of text differently without inherently changing the DOM, regardless of whether you do it statically or dynamically (with Javascript, for example, as a post processing step).
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