metalbox
metalbox

Reputation: 302

change the appearance of input type number

I tried this code but nothing happened. I need to change the arrows by an image also rotate but I could not.

<style>
input[type=number] {
    height: 30px;
    line-height: 30px;
    font-size: 16px;
    padding: 0 8px;
}
input[type=number]::-webkit-inner-spin-button { 
    -webkit-appearance: none;
    cursor:pointer;
    display:block;
    width:8px;
    color: #333;
    text-align:center;
    position:relative;
}    
input[type=number]:hover::-webkit-inner-spin-button { 
    background: #eee url('https://i.sstatic.net/YYySO.png') no-repeat 50% 50%;  
    width: 14px;
    height: 14px;
    padding: 4px;
    position: relative;
    right: 4px;
    border-radius: 28px;
}
</style>

<input type="number" value="0">

https://i.sstatic.net/YYySO.png

http://jsfiddle.net/josefelipe87/wf0w0dhw/

Upvotes: 0

Views: 7157

Answers (1)

psanjib
psanjib

Reputation: 1301

Different code for different browser in CSS

For mozila

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

For Chrome

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
      -webkit-appearance: none; 
      margin: 0; 
}

Upvotes: 1

Related Questions