The :focus pseudo-class applies while an element has the focus, i.e. accepts keyboard or mouse events, or other forms of input.
In an HTML document, an element must receive focus from the user in order to become active and perform its tasks. For example, users must set input focus on a link in order to follow it. Similarly, users must give a textarea focus in order to enter text into it.
There are several ways to give focus to an element:
The following style rule will change the background color of any element that receives input focus:
*:focus {
background-color: #ffc;
}
Related specifications
:focus
:focus
Microsoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4