Summary:
Styling to Remove Number Input Spinner in Web Browsers
<input type="number" />
Expanding on the Solution:
To further enhance the initial solution...
Firefox Behavior:
For Firefox browsers, the default styling for number input fields can be modified by changing the -moz-appearance
property to 'textfield', effectively hiding the spinner.
input[type="number"] {
-moz-appearance: textfield;
}
In certain scenarios, you may wish to initially hide the spinner and only display it upon hover/focus. In such cases, the following CSS rules can be implemented:
Enhanced Styling for Number Input Field on Hover/Focus
<input type="number"/>
Chrome Behavior:
In Chrome browsers, the default styling can be altered by modifying the -webkit-appearance
property to 'none' within the pseudo classes affecting the spinner appearance.
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
<input type="number" />
Note that setting margin: 0
is used specifically to eliminate the margin in previous versions of Chrome.
The default user agent styling for the 'inner-spin-button' pseudo class in Chrome is as follows:
User Agent Styling for 'inner-spin-button'