E:focus

The :focus pseudo-class applies while an element has the focus. (Source: W3C)

HTML:

  1. <input type="text" name="example-field" id="example" />

CSS:

  1. input{color:black}
  2. input:focus{color:red}

Output:

In the example, the text should turn red when you place your cursor inside the text field.