litel litel - 3 years ago 213
CSS Question

Why doesn't ":focus:not(:active)" pseudo-class work?

I'm trying to figure out if there's a way to allow for prevent the styling of the ":focus" pseudo-class from being applying when there is a ":focus:active" or click event without the use of jQuery/JS. As the ":active" state is dependent on the ":focus" state, I would presume that ":focus:not(:active)" work, but it does not. Is there any way to combine ":not" with ":focus" to prevent "focus:active" from triggering "focus"?

Answer Source

Something can not get focused until it is active. So :focus:not(:active) is impossible. It can never be triggered.

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