如何突出显示HTML文本而不用标签包装? [英] How to highlight HTML text without wrapping it with tags?
本文介绍了如何突出显示HTML文本而不用标签包装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以使用< span>
或任何其他标签来包含HTML文档中的文本吗?
Is it possible to highlight text in an HTML document using without wrapping it with <span>
or any other tag for that matter?
例如,在HTML代码< p>快速狐狸< / p>
我想突出显示快速
,但不会在其周围添加DOM元素。将DOM元素添加到父元素很好。
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.
谢谢!
推荐答案
不,这是不可能的。
无论您是静态还是动态地进行,都无法让浏览器以不同的方式渲染文本,而不必改变DOM。 ,作为后期处理步骤)。
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).
这篇关于如何突出显示HTML文本而不用标签包装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文