Maigret Maigret - 5 months ago 140
CSS Question

Styling a input type=number

Is it possible apply a style in the inner "arrow up" and "arrow down" of a input type=number in css? I would like to change to blue the background of arrow up and red the arrow down. Any ideas?

styling inner arrows

Answer

You can try the following but keep in mind that works only for Chrome:

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]::-webkit-inner-spin-button:before,
input[type=number]::-webkit-inner-spin-button:after {
    content: "^";
    position:absolute;
    right: 0;
    font-family:monospace;
    line-height:
}

input[type=number]::-webkit-inner-spin-button:before {
    top:0px;
}

input[type=number]::-webkit-inner-spin-button:after {
    bottom:0px;
    -webkit-transform: rotate(180deg);
}
<input type="number" />

Comments