How to reverse the color of a text field when a user clicks on it using CSS

The question is in the subject.

+5
source share
3 answers
input[type='text']:focus {  
    background-color: #0066FF;  
}
+3
source

You can use the CSS pseudo-class selector as follows:

textarea:focus { background-color: red }

Please note that this does not work IE7 and below .

+4
source

Demonstration:)

textarea:focus
{
   background-color: #00ff00;
}
+4
source

All Articles