Google Chrome now, and Opera before, shows a "spin box" control beside a input field of type "number". I want to be able to style this, or hide it. Are there ways of controlling this UI element yet?
EG:
<-- That little ui element with an up and down arrow. It's not that functional and its adding unnedded elements to a form I've created.I understand I can just not have the type as "number" but it allows built in prevention of entering anything other than a number, and is semantically correct.
At the moment, the answer is no - as far as I know anyway.
The HTML5 spec generally doesn't want to dictate what the user interface should look like, this also applies to the input type=number feature. I think there is a sort of implicitly expected workflow which goes somewhat like
input from authors/browser vendors/interesting people > spec text in HTML spec > implementations (experimenting with UI) > UI conventions (experimenting with styling) > CSS proposals > CSS spec for how to style the new controls.
Hence, real control over the rendering of the new inputs won't be possible in the near future. Of course, browsers may meanwhile implement experimental vendor-specific CSS extensions..
精彩评论