I know there is a :focus selector. I can’t seem to find use of or documentation of a :blur selector. Is there one?
I know there is a :focus selector. I can’t seem to find use of
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no
:blurpseudo-class in CSS.The dynamic pseudo-classes, like other pseudo-classes and in fact all other selectors, represent states; they do not represent events or transitions between states in terms of the document tree. To wit: the
:focuspseudo-class represents an element that is in focus; it does not represent an element that has just received focus, nor does there exist a:blurpseudo-class to represent an element that has just lost focus.Similarly, this applies to the
:hoverpseudo-class. While it represents an element which has a pointing device over it, there is neither a:mouseoverpseudo-class for an element that has just been pointed to nor a:mouseoutpseudo-class for an element that has just been pointed away from.If you need to apply styles to an element that is not in focus, you have two choices:
Use
:not(:focus)(with less browser support):Declare a rule that applies to any element regardless of its focus state, and override for elements that have focus: