Pseudo-class :focus

The :focus CSS pseudo-class represents an element
(such as a form input) that has received focus. It
is generally triggered when the user clicks or
taps on an element or selects it with the
keyboard’s Tab key.

input:focus {
  background-color: lightblue;
}

select:focus {
  background-color: ivory;
}

.red-input:focus {
  background: yellow;
  color: red;
}