Can we highlight only the line being hovered over by the mouse pointer? For instance, if I have this paragraph:
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nam in nisi eleifend, efficitur ligula vel, scelerisque risus.
Interdum et malesuada fames ac ante ipsum primis in faucibus.
Nam semper diam sodales eros dictum euismod. Duis ut hendrerit leo. Sed iaculis sem ac est porttitor facilisis.
In convallis facilisis libero ut interdum. Phasellus scelerisque ex in lacus tempus mollis. Integer scelerisque viverra elit id fringilla. Proin nibh arcu, imperdiet a lacus ac, feugiat interdum sapien. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse ultrices vestibulum orci, a varius quam cursus ut. Nulla ut suscipit sapien. Morbi et urna elementum, pretium augue non, tristique nulla. Nulla massa tellus, facilisis at fringilla et, rutrum ac libero.
</p>
Could we emphasize the first line when it is hovered over, followed by the second line and so on?
Illustration: https://i.sstatic.net/1D2T0.jpg Source:
I am interested in a solution that applies to multi-line paragraphs without manual span addition.
EDIT (21.06.2016): - (solution for entire paragraph highlighting)
Rory McCrossan's solution was effective, but I encountered issues with implementation on my WordPress blog. The highlighting position calculation went awry after scrolling. However, I stumbled upon an elegant solution while working on this website—you can use hover.css and add the class hvr-fade
to each <p>
tag. While this doesn't exactly address the original question, it offers a simple way to tackle a similar problem with impressive CSS hover effects collection. Hopefully, this proves beneficial to someone...