当Input框需要输入数字时,一般用到type='number'
但是在输入框有
上下小箭头
google后有解决CSS方案
在chrome下:
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button{ -webkit-appearance: none !important; margin: 0; }
Firefox下:
input[type="number"]{-moz-appearance:textfield;}
第二种方案:
将type="number"改为type="tel",同样是数字键盘,但是没有箭头。
第三种方案:
<input type="text" pattern="[0-9]*" /> A pattern of \d* will also work.
查询HTML5 W3C

这是html5的属性,多了很多实用的校检
本文介绍了如何在Chrome和Firefox浏览器中解决输入框带有上下小箭头的数字键盘问题,提供了CSS方案、将type='number'改为type='tel'的方法,以及使用pattern属性替代数字键盘的解决方案。
773

被折叠的 条评论
为什么被折叠?



