Is there any way to add: hover to CSS: first-line pseudo-class?

I was looking for some CSS for HTML markup. The problem I am facing is that there is a style already applied using CSS :first-line pseudo :first-line class. I want to change the style of this first line on hover. Is there a way to apply something like p:first-line:hover ?

+6
source share
3 answers

You must define p:first-line to define the chain p:first-line:hover as follows:
p:first-line { color: black; }
p:hover:first-line { color: red; }

Fiddle

+9
source

A very exciting topic! I tried the jQuery version and found out that even this would not work. In Firefox, the class must be applied first to work with freezing, as you can see in this Fiddle . But WebKit completely ignores the addition of a dynamic class :first-line .

 <p class="hovered">Text .... </p> 

For Firefox, the class must be set in the HTML code. Now the next task is performed.

 jQuery('p').removeClass('hovered'); jQuery('p').hover(function() { jQuery(this).addClass('hovered'); }, function() { jQuery(this).removeClass('hovered'); }); 

But does not work in WebKit.

+1
source

Yes, you can link them (see here ).

 p:hover:first-line 
0
source

All Articles