Hide Spinner in Input Number - Firefox 29

后端 未结 7 728
傲寒
傲寒 2020-12-02 04:22

On Firefox 28, I\'m using works great because it brings up the numerical keyboard on input fields which should only contain number

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 05:09

    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;
    }

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

提交回复
热议问题