Is it possible to always show up/down arrows for input "number"?

HtmlCssInputWebkitShadow Dom

Html Problem Overview


I want to always show up/down arrows for input "number" field. Is this possible? So far I haven't had any luck...

http://jsfiddle.net/oneeezy/qunbnL6u/

HTML:

<input type="number" />

CSS:

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button {  
    
   -webkit-appearance: "Always Show Up/Down Arrows";
        
}
    
    
    

Html Solutions


Solution 1 - Html

You can achieve this (in Chrome at least) by using the Opacity property:

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button {  

   opacity: 1;

}

As stated above, this will likely only work in Chrome. So be careful using this code in the wild without a fallback for other browsers.

Solution 2 - Html

I tried this and it worked

Solution 3 - Html

If you're trying to get the same appearance across different browsers you may be forced to use a plugin/widget or build one yourself, the main browsers all seem to implement number spinners differently.

Try jQuery UI's spinner widget it offers a lot more versatility when it comes to styling.

Working Example

<p>
    <label for="spinner">Select a value:</label>
    <input id="spinner" name="value" />
</p>

$("#spinner").spinner();

Solution 4 - Html

I tried this and it's working

input[type=number]::-webkit-inner-spin-button {
    opacity: 1
}

Solution 5 - Html

If you don't mind the focus on your input, do

   document.getElementById(<id>).focus();

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionOneezyView Question on Stackoverflow
Solution 1 - HtmlBJackView Answer on Stackoverflow
Solution 2 - HtmlAtta H.View Answer on Stackoverflow
Solution 3 - HtmlapaulView Answer on Stackoverflow
Solution 4 - HtmlMunish KumarView Answer on Stackoverflow
Solution 5 - HtmlIrina RapoportView Answer on Stackoverflow