We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

:focus Redirect 1


The :focus CSS pseudo-class is applied when a element has received focus, either from the user selecting it with the use of a keyboard or by activating with the mouse (e.g. a form input).


<element>:focus { ... }


.first-name:focus { color: red; }
.last-name:focus { color: lime; }
<input class="first-name" value="I'll be red when focused">
<input class="last-name" value="I'll be lime when focused">


Specification Status Comment
Selectors Level 4 Working Draft No change.
Selectors Level 3 Recommendation No change.
CSS Level 2 (Revision 1) Recommendation Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 1.0 (1.7 or earlier) 8.0 7.0 1.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 1.0 1.0 (1) 8.0 6.0 1.0


Document Tags and Contributors

 Last updated by: Sheppy,