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

后端 未结 17 1458
感动是毒
感动是毒 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

    I've encountered this problem with a input[type="datetime-local"], which is similar to this problem.

    And I've found a way to overcome this kind of problems.

    First, you must turn on chrome's shadow-root feature by "DevTools -> Settings -> General -> Elements -> Show user agent shadow DOM"

    Then you can see all shadowed DOM elements, for example, for , the full element with shadowed DOM is:

    
      

    And according to these info, you can draft some CSS to hide unwanted elements, just as @Josh said.

提交回复
热议问题