The :focus pseudo-class applies while an element has the focus (accepts keyboard or mouse events, or other forms of input).

:focus {
    css declarations;
}
input:focus {
   border:1px solid #3366ff;
   background: #ffff99;
}

Click the button below to experiment with this selector.

Give it a Try!

2.0Firefox 8.0Explorer 4.0Chrome 3.1Safari 9.6Opera