Easy Tutorial
❮ Css3 Pr Box Orient Pr Margin Bottom ❯

CSS :focus Selector

Complete CSS Selector Reference

Example

Styling an input field when it gains focus:


Definition and Usage

The :focus selector is used to select the element that has focus.

Tip: The :focus selector is applicable to elements that receive keyboard events or other user inputs.


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Selector
:focus 4.0 8.0 2.0 3.1 9.6

Note: The :focus selector requires a <!DOCTYPE> declaration in IE8.


Related Articles

CSS tutorial: CSS Pseudo-classes


Complete CSS Selector Reference

❮ Css3 Pr Box Orient Pr Margin Bottom ❯