Suppose I have HTML / JSX like this:
<ul>
<li>First bullet point</li>
<li>Second bullet point</li>
</ul>
and I want to highlight a range that "spans" multiple list elements "contiguously":
<ul>
<li>First bullet <mark>point</mark></li>
<li><mark>Second bullet</mark> point</li>
</ul>
Lastly, I'd like to add behaviour such that hovering over the first <mark>
tags will trigger something for the second <mark>
tags and vice versa. From the user's perspective, it should look and feel like a single <mark>
tag.
Can this be done exclusively with CSS / Tailwind? Based on what I've seen so far, the sibling ~
combinator can only be used on earlier elements to affect later elements. The same appears to be true for the peer
class in Tailwind.
If Javascript is required, can someone point me in the right direction? FWIW, this is for a React project so there may be some caveats to manipulating the DOM directly.
`.
– jimmy Feb 15 '23 at 19:15