Can I hide the HTML5 number input’s spin box?

后端 未结 17 1457
感动是毒
感动是毒 2020-11-22 05:08

Is there a consistent way across browsers to hide the new spin boxes that some browsers (such as Chrome) render for HTML input of type number? I am looking for a CSS or Jav

17条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 05:40

    Only add this css to remove spinner on input of number

    /* For Firefox */
    
    input[type='number'] {
        -moz-appearance:textfield;
    }
    
    
    
    /* Webkit browsers like Safari and Chrome */
    
    input[type=number]::-webkit-inner-spin-button,
    input[type=number]::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    

提交回复
热议问题