DEV Community

How can we apply pseudo-class on a single line without CSS?

Robiabo on October 20, 2020

Hello everybody, I've learned how to apply pseudo-class by using CSS style. For example, a: hover {color: green} . My QUESTION:- How can we apply...
Collapse
 
kallmanation profile image
Nathan Kallman

As in, how in javascript do you detect hover/focus/etc?

There's a whole slew of mouse events (like onmouseover and onmouseleave will trigger for the beginning and ending of a "hover")
w3schools.com/jsref/obj_mouseevent...

Collapse
 
robiabo profile image
Robiabo

Thanks. But you mean by javascript!

Collapse
 
kallmanation profile image
Nathan Kallman

Yes, sorry I thought that's what was meant by "without CSS". Is the question asking for inline styling?

Collapse
 
richardsprins profile image
Richard S Prins Jr.

Pseudo classes won't work inline from my experience