Customizing Increment Arrows on Input of Type Number Using CSS

后端 未结 4 1947
误落风尘
误落风尘 2020-11-28 19:58

I have an input of type number that is rendered using the following code:

4条回答
  •  旧巷少年郎
    2020-11-28 20:09

    You can easily convert first design with second one like this:

    HTML

    CSS

    .quantity{
       display:flex;
       width:160px;
    }
    
    /* it will support chrome and firefox */
    .quantity input[type=number]::-webkit-inner-spin-button,
    .quantity input[type=number]::-webkit-outer-spin-button{
       -webkit-appearance:none;
    }
    
    .quantity input,.quantity button{
       width:50px;
       padding:.5em;
       font-size:1.2rem;
       text-align:center;
       font-weight:900;
       background:white;
       border:1px solid #aaa;
    }
    
    .quantity input{
       border-left:none;
       border-right:none;
    }
    

提交回复
热议问题