{"id":14188,"date":"2011-09-06T20:02:46","date_gmt":"2011-09-07T03:02:46","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=14188"},"modified":"2021-02-15T07:33:46","modified_gmt":"2021-02-15T15:33:46","slug":"focus","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/selectors\/f\/focus\/","title":{"rendered":":focus"},"content":{"rendered":"\n

The :focus<\/code> pseudo class in CSS is used for styling an element that is currently targeted by the keyboard, or activated by the mouse. Here is an example:<\/p>\n\n\n\n

textarea:focus {\n  background: pink;\n}<\/code><\/pre>\n\n\n\n