Is there a way to hide the new HTML5 spinbox controls shown in Google Chrome & Opera? [duplicate]

空扰寡人 提交于 2019-12-06 22:16:19

问题


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.


回答1:


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..



来源:https://stackoverflow.com/questions/3527865/is-there-a-way-to-hide-the-new-html5-spinbox-controls-shown-in-google-chrome-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!