3 回答
TA贡献1776条经验 获得超12个赞
Firefox 29目前增加了对数字元素的支持,因此这里有一个代码片段,用于在基于webkit和Moz的浏览器中隐藏旋转器:
input[type='number'] {
-moz-appearance:textfield;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
<input id="test" type="number">
TA贡献1934条经验 获得超2个赞
简短答覆:
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
input[type="number"] {
-moz-appearance: textfield;
}
<input type="number" />
较长的答覆:
Firefox:
-moz-appearance
number-input
textfield
input[type="number"] { -moz-appearance: textfield;}
input[type="number"] {
-moz-appearance: textfield;
}
input[type="number"]:hover,
input[type="number"]:focus {
-moz-appearance: number-input;
}
<input type="number"/>
铬:
-webkit-appearance
textfield
-webkit-appearance
none
::-webkit-outer-spin-button
/::-webkit-inner-spin-button
-webkit-appearance: inner-spin-button
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
<input type="number" />
margin: 0
input::-webkit-inner-spin-button { -webkit-appearance: inner-spin-button; display: inline-block; cursor: default; flex: 0 0 auto; align-self: stretch; -webkit-user-select: none; opacity: 0; pointer-events: none; -webkit-user-modify: read-only;}
添加回答
举报