html数字输入字段始终显示微调器? [英] html number input field always display spinner?

查看:137
本文介绍了html数字输入字段始终显示微调器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我输入这样的数字输入字段时:

when I make a number input field like this:

<input type="number" />

然后,只要我将鼠标悬停在数字字段上,数字字段就会添加一个微调框。很多人都在谈论如何禁用这些微调器,例如:

Then the number field gets a spinner added to it whenever I hover over the field. A lot of people talk about how to disable these spinners like this:

http://css-tricks.com/snippets/css/turn-off-number-input-spinners/

但是我想知道如何使它们始终可见,而不仅仅是当您将鼠标悬停在它们上时?

But I would like to know how do you make them ALWAYS visible and not just when you hover over them?

推荐答案

无法使用特定于浏览器的样式执行此操作。
您可能需要使用一些Javascript自己构建该功能,或者在互连网上查找预制的脚本。

It is not possible to do this with the Browser specific style. You would need to either build that functionality yourself using some Javascript or look for a premade script on the interwebs.

您只能隐藏那些Shadow DOM元素,因为它们会触发非常特定于浏览器的css属性,以提供onclick或onhover等功能。

You can only hide those Shadow DOM elements as they trigger very browserspecific css-attributes to provide the functionalitys like onclick or onhover.

请参阅: http://css-infos.net/property/-webkit-外观(您可以为输入字段触发其他行为,但不能强制使其始终可见)

See: http://css-infos.net/property/-webkit-appearance (You could trigger another behaviour for your Input-Field, but you cant force it to be always visible)

这篇关于html数字输入字段始终显示微调器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆