Edit & Run
In this example, we use the :focus selector to add a black border color to the text field when it gets focused (clicked on):
Note that we have added the CSS3 transition property to animate the border color (takes 0.5 seconds to change the color on focus).