This code will work in Opera, look odd in IE and do nothing in Firefox.

I suspect you're looking in IE?

Form controls are troublesome to style and impossible to get consistency cross browser so they're usually best left alone not only for this reason but also because users are familiar with how form controls look and changing them is likely to confuse users rather than improve usability.

Apart from maybe using an image for a submit button and altering the default font, I'd generally leave form controls as their default style.

PaulOB
—
2007-10-17T15:13:57Z —
#5

Yes, I'm sorry I wasn't clear enough

What I've shown you is all that you can do.

You can see here what happens in other browers to see how futile this kind of thing is:

That invalid markup (inline-level input as immediate child of form is not allowed in a Strict DTD, and if you insist on 'XHTML' you must close the <input> tag).

It's not a good solution anyway, because it will not work if JavaScript is disabled or unsupported.

DaveWoods
—
2007-10-18T07:53:37Z —
#8

This not working without JavaScript would worry me the most as it will simply appear as though it's broken which you may not think as a huge issue but if I visited a site and something like this didn't work then I certainly wouldn't trust the site to store my personal details, credit card information.

There are probably some solutions using external JavaScript which will do what you want it to do but will also leave the form unstyled for users without JavaScript which would be a much better approach as you won't be excluding any of your visitors.