Set input box color settings in CSS file
I want to set the background color of Input Box to Cyan w开发者_StackOverflowhen 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
{
}
You could use the :focus pseudo-class, however it won't work in all browsers (like IE6).
input.entryFormColor:focus {
background: cyan;
}
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.
精彩评论