Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the backcolor of a textbox when user clicks into it with CSS

Question is in the subject.

like image 606
leora Avatar asked Feb 27 '10 21:02

leora


People also ask

How do I change the background color of a text box in CSS?

To add background color to the form input, use the background-color property.

How do you change the background of a textbox in HTML?

To add background color in HTML, use the CSS background-color property. Set it to the color name or code you want and place it inside a style attribute. Then add this style attribute to an HTML element, like a table, heading, div, or span tag.


2 Answers

Demonstration :)

textarea:focus
{
   background-color: #00ff00;
}
like image 63
Sarfraz Avatar answered Oct 21 '22 16:10

Sarfraz


You can use CSS pseudo-class selectors like this:

textarea:focus { background-color: red }

Note that this doesn't work IE7 and lower.

like image 20
Otto Allmendinger Avatar answered Oct 21 '22 15:10

Otto Allmendinger