Is it possible to always show up/down arrows for input “number”?

前端 未结 4 1551
感动是毒
感动是毒 2020-12-01 00:33

I want to always show up/down arrows for input \"number\" field. Is this possible? So far I haven\'t had any luck...

http://jsfiddle.net/oneeezy/qunbnL6u/

<

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-01 01:25

    You can achieve this (in Chrome at least) by using the Opacity property:

    input[type=number]::-webkit-inner-spin-button, 
    input[type=number]::-webkit-outer-spin-button {  
    
       opacity: 1;
    
    }
    

    As stated above, this will likely only work in Chrome. So be careful using this code in the wild without a fallback for other browsers.

提交回复
热议问题