Hide Spinner in Input Number - Firefox 29
According to this blog post, you need to set -moz-appearance:textfield;
on the input
.
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" step="0.01"/>
It's worth pointing out that the default value of -moz-appearance
on these elements is number-input
in Firefox.
If you want to hide the spinner by default, you can set -moz-appearance: textfield
initially, and if you want the spinner to appear on :hover
/:focus
, you can overwrite the previous styling with -moz-appearance: number-input
.
input[type="number"] {
-moz-appearance: textfield;
}
input[type="number"]:hover,
input[type="number"]:focus {
-moz-appearance: number-input;
}
<input type="number"/>
I thought someone might find that helpful since I recently had to do this in attempts to improve consistency between Chrome/FF (since this is the way number inputs behave by default in Chrome).
If you want to see all the available values for -moz-appearance
, you can find them here (mdn).
In SASS
/SCSS
style, you can write like this:
input[type='number'] {
-moz-appearance: textfield;/*For FireFox*/
&::-webkit-inner-spin-button { /*For Webkits like Chrome and Safari*/
-webkit-appearance: none;
margin: 0;
}
}
Definitely this code style can use in PostCSS
.