Bankin Bankin - 1 year ago 262
jQuery Question

Css hover on before element

I have a div and a div:before. I want when the mouse goes over (hover) the :before element to change its color. Is there a way to do it no matter with css or jQuery?

I tried stuff like div:before:hover but nothing happened

Thanks in advance

Answer Source

Solution 1

(doesn't resolve question) With just css:

span:before {
    color: red;
    content: "hi";
span:hover:before {
    color: blue;



edit: fiddle

Solution 2

Work around for given problem without :before

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download