I’m trying to create a highlight effect, where text that is hovered over is labeled in black. The structure of the html will have this content floating to the right.
The problem is that I only want to highlight the WORD, not the entire area of the div tag. Any ideas?
A simple solution would be to wrap the textual content in an additional element and add the background color attribute to it. For example a
<span>element.Then your jQuery code would look something like this –
Or you could just add the hover event to the internal
<span>–Working demo