RKh
RKh

Reputation: 14161

Set input box color settings in CSS file

I want to set the background color of Input Box to Cyan when it gets focus and to White when it looses focus. I want to define this in a CSS file. While writing the CSS code, I searched for the OnFocus and OnBlue events, but didn't find. Please let me know how to define these properties within this code block:

input.entryFormColor
{

}

Upvotes: 0

Views: 2184

Answers (2)

Ben Everard
Ben Everard

Reputation: 13804

You could use the :focus pseudo-class, however it won't work in all browsers (like IE6).

input.entryFormColor:focus { 
    background: cyan;
}

Upvotes: 1

Darren Oster
Darren Oster

Reputation: 9196

Try something like:

input.entryFormColor { background: white; }
input.entryFormColor:focus { background: cyan; }

Check out http://www.w3schools.com/CSS/pr_pseudo_focus.asp for more info.

Upvotes: 0

Related Questions