Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.6k views
in Technique[技术] by (71.8m points)

html - Highlighting divs without empty spaces in between

given the code in the screenshot

enter image description here

I get words highlighted in yellow if I take a note.

enter image description here

How could I achieve the result where the empty spaces between these words would be highlighted too, so that the whole note is highlighted in yellow? The span element sorrounding all these divs (wrd) is there by chance, so it could easily exists some other structure. I thought of wrapping all these divs and apply a style to a container, but the problem is that I can not wrap these words in any container as they may pertain to several notes and some of these notes could even contain a subset of these words or some text after the words I have highlighted (running the risk to break the HTML structure opening and closing divs the wrong way).

The element wrd has no custom CSS style applied.

Thanks for your help and time!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

WRDS element are now spaced like this:

<wrd>Content</wrd>`whitespace`<wrd>Content2</wrd>

You need to contain whitespaces in the wrd element like this:

<wrd>Content </wrd><wrd>Content2 </wrd>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...