How to highlight HTML text without wrapping it with tags?

Is it possible to select text in an HTML document without using it without <span>or any other tag?

For example, in HTML, <p>The quick fox</p>I would like to highlight quick, but without adding a DOM element around it. Adding a DOM element to the parent element is fine.

Thanks!

+5
source share
4 answers

No, It is Immpossible.

You cannot tell the browser to render a piece of text differently without changing the DOM, regardless of whether you execute it statically or dynamically (for example, using Javascript as a post-processing step).

+8

, ( rgba hsla) .

canvas , .

+1

.

, , , , Javascript magic. -

<p highlight="quick">The quick fox</p>

JQuery/Prototype/plain JS, , ? , - .

0

The only way to do this than I can imagine is to use an element <canvas>and display absolutely everything manually.

0
source

All Articles