How can I add padding-right to an input type=“number” when aligning right?

前端 未结 4 1543
-上瘾入骨i
-上瘾入骨i 2021-01-03 19:00

I can\'t believe I haven\'t been able to find anything about this problem.

In my new project the future user will have a column with some input type=\"number\"

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-03 19:11

    Rather than using padding-right use the following CSS

    input::-webkit-outer-spin-button, 
    input::-webkit-inner-spin-button { margin-left: 20px; } 
    

    and for Firefox above solution won't work, so the best solution is just to hide it :

    input[type=number] {
        -moz-appearance:textfield;
    }
    

    or you can try to "play" with some jquery plugin.

提交回复
热议问题