Hide Up & Down Arrow Buttons (Spinner) in Input Number - Firefox 29

CssFirefoxInputSpinner

Css Problem Overview


On Firefox 28, I'm using <input type="number"> works great because it brings up the numerical keyboard on input fields which should only contain numbers.

In Firefox 29, using number inputs displays spin buttons at the right side of the field, which looks like crap in my design. I really don't need the buttons, because they are useless when you need to write something like a 6~10 digit number anyway.

Is it possible to disable this with CSS or jQuery?

Css Solutions


Solution 1 - Css

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"/>

Solution 2 - Css

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).

Solution 3 - Css

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.

Solution 4 - Css

/* for chrome */
    input[type=number]::-webkit-inner-spin-button,
    input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;}             

   
/* for mozilla */  
   input[type=number] {-moz-appearance: textfield;}

Solution 5 - Css

Faced the same issue post Firefox update to 29.0.1, this is also listed out here https://bugzilla.mozilla.org/show_bug.cgi?id=947728

Solutions: They(Mozilla guys) have fixed this by introducing support for "-moz-appearance" for <input type="number">. You just need to have a style associated with your input field with "-moz-appearance:textfield;".

I prefer the CSS way E.g.:-

.input-mini{
-moz-appearance:textfield;}

Or

You can do it inline as well:

<input type="number" style="-moz-appearance: textfield">

Solution 6 - Css

This worked for me:

    input[type='number'] {
    appearance: none;
}

Solved in Firefox, Safari, Chrome. Also, -moz-appearance: textfield; is not supported anymore (https://developer.mozilla.org/en-US/docs/Web/CSS/appearance)

Solution 7 - Css

In 2021, there is a much better solution to make your firefox like Google Chrome. You should use focus and hover, too.

input[type="number"] {
	appearance: none; /* textfield also works! */
}

input[type="number"]:focus, 
input[type="number"]:hover {
	appearance: auto;
}

for more information, please read the documentation

Solution 8 - Css

I mixed few answers from answers above and from https://stackoverflow.com/questions/13107118/how-to-remove-the-arrows-from-inputtype-number-in-opera/22306944 in scss:

input[type=number] {
  &,
  &::-webkit-inner-spin-button,
  &::-webkit-outer-spin-button {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;

    &:hover,
    &:focus {
      -moz-appearance: number-input;
    }
  }
}

Tested on chrome, firefox, safari

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNereuJuniorView Question on Stackoverflow
Solution 1 - CssRichard DeemingView Answer on Stackoverflow
Solution 2 - CssJosh CrozierView Answer on Stackoverflow
Solution 3 - CssAmerllicAView Answer on Stackoverflow
Solution 4 - Cssnavin prakashView Answer on Stackoverflow
Solution 5 - CssAbhijeetView Answer on Stackoverflow
Solution 6 - CssYahel YechieliView Answer on Stackoverflow
Solution 7 - CssExisView Answer on Stackoverflow
Solution 8 - CssDarex1991View Answer on Stackoverflow