141 of 298 menu

The focus pseudo-class

The focus pseudo-class sets styles for input, textarea or links with input focus. Input focus - this is when we clicked on the input and the stick cursor blinks (you can enter text).

Syntax

input:focus { }

Example

After receiving focus, the input will have a red border and shadow:

<input> input:focus { border: 1px solid red; box-shadow: 0 0 3px red; }

:

See also

  • pseudo-class link,
    which sets the style for an unvisited link
  • pseudo-class visited,
    which sets the style for a visited link
  • pseudo-class hover,
    which sets the style for a hover link
  • pseudo-class active,
    which sets the style of the link in activation
enru