Fotiman - 3:59 pm on Sep 3, 2013 (gmt 0)
1. It's best to avoid inline style attributes, as it makes maintenance more difficult, adds to your page weight that won't be cached, and prevents a clean separation of layers (content/presentation/behavior).
2. I've found it's usually not a good idea to style the form element itself, but rather style some container element within the form. I don't remember the specifics, but I had some problems a few years back with browser inconsistencies (so it may not be an issue still). In any case, I try to avoid directly applying presentation to a form.
A better alternative might simply be:
And, technically, the C in onClick and onChange, etc. should be capitalized, but browsers don't seem to care too much
Actually, that's not true. HTML attributes have always been case insensitive, and then XHTML came along and made them case sensitive, with "onclick" being correct and "onClick" being incorrect. In general, it's best to use all lower case and you're safe in either markup language, or better yet, avoid using inline handlers altogether.